Ryan Alford

Ryan Alford

  • NA
  • 1.7k
  • 1.7m

Serial Port problem

Nov 27 2007 11:14 AM
I am writing an application that listens to a serial port(COM1) for input from a barcode scanner.  The problem I am having is when I move between different forms.  In the form load event on each form, I set the port name:

serialPort.PortName = "COM1"

to the correct COM port.  Whenever I am ready to move to another form, I call:

serialPort.Close()
serialPort.Dispose()

However, when I open the next form, I get the "access denied" error when trying to open the port again.

I am using the SerialPort control on the form rather than programmatically creating a serialPort.

Answers (8)