Click here to Skip to main content
15,039,525 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Hi, i have tried so many time , But every time i got an error while receiving data from the serial port in help to resolve my problem. Thank you in advance.

What I have tried:

Private Sub ReceivedText(ByVal [text] As String)
        'compares the ID of the creating Thread to the ID of the calling Thread
        Dim PLCdata(20) As Integer
        If Me.rtbReceived.InvokeRequired Then
            Dim x As New SetTextCallback(AddressOf ReceivedText)
            Me.Invoke(x, New Object() {(text)})
            Call StrToHex(text)
            Me.rtbReceived.Text = sHex
            ' For Me.I = 1 To 15
            'PLCdata(I) = ASC(Mid$(text, I, 1))
        End If
    End Sub
Updated 1-Nov-17 3:25am
Ralf Meier 31-Oct-17 8:27am
I'm sorry ... this code doesn't make any sense for me in combination with your question.
What are you exactly trying to do ?
What happens and what should happen ?
ledtech3 31-Oct-17 8:35am
The code is not clear and is missing some of the code it calls to. Try this search term and see if others have already done what you want to do. "serial port" It got quite a few hits.
CPallini 31-Oct-17 8:53am
Please post the actual code.
Dave Kreskowiak 31-Oct-17 10:01am
On top of everything else, you never said what the error was.

That's kind of the most important piece of information you can have when debugging code.

1 solution

As mentioned in the comments, you'll need to provide the error message for anyone to even try and help you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900