Subject: OnComm() not working ???
Posted By: johnjohn Post Date: 11/19/2004 9:57:52 AM
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


Go to topic 22309

Return to index page 711
Return to index page 710
Return to index page 709
Return to index page 708
Return to index page 707
Return to index page 706
Return to index page 705
Return to index page 704
Return to index page 703
Return to index page 702