troubleshooting Question

Receive Serial (string or byte) Data in Visual Basic

VASILIS PALAVRATZISFlag for Greece asked on
Visual Basic.NET
7 Comments1 Solution414 ViewsLast Modified:
down vote
I have a serial device which sends me data at the baudrate of 38400 and i get it like this ?@D00014C000 000. I can see data comes in on a ritchtextbox but what im trying to do is to use some characters from the string in a list box. For example i want characters "14C" appears in the listbox3. I tried the substring and mid function but listbox lidnt work properly and losses characters or confuse them . Here is my code. Any suggestions please?? i am using visual studio express 2012

Imports System
Imports System.ComponentModel
Imports System.Threading
Imports System.IO.Ports
Public Class frmMain
    Dim myPort As Array
    Delegate Sub SetTextCallback(ByVal [text] As String)
    'Serial Port Receiving Code Starts Here ....
    Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
    End Sub
    'Serial Port Receiving Code Ends Here ....
    'Serial Port Receiving Code(Invoke) Starts Here ....
    Private Sub ReceivedText(ByVal [text] As String)
        If Me.rtbReceived.InvokeRequired Then
            Dim x As New SetTextCallback(AddressOf ReceivedText)
            Me.Invoke(x, New Object() {(text)})
            Me.rtbReceived.Text &= [text]
              Dim fine As String = Mid([text], 7, 3)
            Dim list As Integer = ListBox3.Items.Add(fine)
        End If
    End Sub

End Class

Picture 1Picture2
Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros