Hi
I am trying read data from serialport.
The data comes correctly to my Buffer variable,but
in that code (TextBox2.Text = Buffer) vb gives an error.
error is:Cross-thread operation not valid: Control 'TextBox2' accessed from a thread other than the thread it was created on.
How can I get rid of this error
Thanks in advice
I am trying read data from serialport.
The data comes correctly to my Buffer variable,but
in that code (TextBox2.Text = Buffer) vb gives an error.
error is:Cross-thread operation not valid: Control 'TextBox2' accessed from a thread other than the thread it was created on.
How can I get rid of this error
Thanks in advice
Code:
Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
Buffer &= SerialPort1.ReadExisting()
TextBox2.Text = Buffer
End Sub