Coder Guru
Coder Guru

Reputation: 513

vb.net ms comm getting exception

I used microsoft com control 6.0 in the application for sending data to the led control

         MSComm1.EOFEnable = True
        MSComm1.SThreshold = 100
        MSComm1.InputLen = 0
        MSComm1.RThreshold = 1
        MSComm1.InBufferCount = 0
        MSComm1.OutBufferCount = 0
        MSComm1.NullDiscard = False
        MSComm1.CommPort =1
        MSComm1.PortOpen = True <-Getting exception to this line
        ......

I am geting Exception from HRESULT: 0x800A1F45 .Why does this port is not opening . When i run it through vb6 i doesnt get error ...Anybody can help me...

Upvotes: 1

Views: 1588

Answers (1)

Andomar
Andomar

Reputation: 238076

Error 800A1F45 usually means the port is in use by another application.

You can decode an HRESULT according to this Wikipedia article. For 0x800A1F45, you'll find:

  • The third bit is 0, so it's a Microsoft error
  • The facility bits are hex 0xA, or decimal 10, which according to the MSDN list means "Control"
  • The error code bits are hex 0x01F45, or decimal 8005. According to the error list for the MSComm control that means "Port already open"

Upvotes: 1

Related Questions