Getting error about port COM11
Recently a portion of my code which uses port COM11 to simulate a scanning barcode feature has stopped working, giving me an error as follows:
System.UnauthorizedAccessException: Access to the port 'COM11' is denied
This is the code in question, it has always worked for years before I even got the project and now suddenly it doesn't. I have tried rebooting the machine, changing the com port, trying different ports, all giving the same error as above.
Dim SerialPort, Port, BaudRate, Parity, DataBits, StopBits
Port = "COM11"
BaudRate = 9600
Parity = None
DataBits = 8
StopBits = 1
Call Delay(1000)
Set SerialPort = dotNet.System_IO_Ports.SerialPort.zctor(Port, BaudRate, Parity, DataBits, StopBits)
SerialPort.Open
SerialPort.Write PLU & Chr(13)
SerialPort.Close