An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in COM.exe
Additional information: Exception from HRESULT: 0x800A1F52.
No one has been able to tell me why this isn't working. I know VB 2003 doesn't have serial control however I need to send this with the mscomm.
It will break at the line : comm1.Output = Packet(i)
Expand|Select|Wrap|Line Numbers
- Private comm1 As New MSComm
- Public Sub SetupCOM(ByVal comPort As Integer)
- If IsNothing(comm1) Then
- comm1 = New MSComm
- End If
- 'set the properties of the com port
- comm1.CommPort = comPort
- comm1.Settings = "57600,n,8,1"
- 'open the port and clear the buffer if it is not already open (which it better not be)
- If Not comm1.PortOpen Then
- comm1.PortOpen = True
- comm1.InBufferCount = 0
- System.Threading.Thread.CurrentThread.Sleep(100)
- End If
- End Sub
- Public Sub GetIndicator_Info()
- Dim i As Integer
- Dim Packet(6) As Byte
- Packet(0) = 42
- Packet(1) = 6
- Packet(2) = 7
- Packet(3) = 28
- Packet(4) = 45
- Packet(5) = 48
- Packet(6) = 130
- For i = 0 To 5
- comm1.Output = Packet(i)
- Thread.Sleep(5)
- Next i
- End Sub