how to get  the data from com port to visual basic 6 coding using api function ?

Tamilselvan
Tamilselvan used Ask the Experts™
on
how to get  the data from com port to visual basic 6 coding using api function ?

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


good morning!

try something like this...


i hope i can give u some idea...



game-master
Option Explicit
Dim chrCommInput As String

Private Sub myCommPort_OnComm()
    Dim modemInput As String

    If myCommPort.CommEvent = comEvReceive Then
        modemInput = myCommPort.Input
        If Len(modemInput) > 0 Then
            If Asc(modemInput) = 13 Or Asc(modemInput) = 10 Then
                If Asc(modemInput) = 10 Then
                    Debug.Print chrModemLine & "*"
                    MsgBox "This is the comm data:" & UCase(chrModemLine)
                End If
            Else
                If Asc(modemInput) >= 32 And Asc(modemInput) <= 126 Then
                    chrCommInput = chrCommInput & modemInput
                ElseIf Asc(modemInput) = 26 Then
                    chrModemLine = chrCommInput & " "
                End If
            End If
        End If
        
    End If
End Sub

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial