OnComm() not working ???
I everybody
I'm doing a little programm to communicate with the serial port now Im able to send data and also receive data. My problem is that Im using the OnComm() event but it don't seem to work.But I now that I receive data. See my code...
First I'm initializing the port and it work well with this function:
If MSComm1.PortOpen = False Then
'Open COM1
With MSComm1
.CommPort = 1 'Port number
.Settings = "9600,N,8,1" ' 9600 Baud, No Parity, 8 Data Bits, 1 Stop Bit
.RThreshold = 2 ' Fire Rx Event Every Two Bytes
.InputLen = 2 ' When Inputting Data, Input 2 Bytes at a time
.PortOpen = True
End With
End If
Then I use this Sub which never get launch even if I receive data and I can see those data, I really receive it. What is the problem???
Private Sub MSComm1_OnComm()
'If comEvReceive Event then get data and display
If MSComm1.CommEvent = comEvReceive Then
strReceiveBuffer = MSComm1.Input
MsgBox strReceiveBuffer, vbOKOnly
End If
End Sub
Thank you
Johnjohn
|