Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SerialPort

Status
Not open for further replies.

selimsl

Programmer
Aug 15, 2005
62
TR
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

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top