Read data from a SerialPort: cross-thread not true
-
Hi All, I have a problem with a serialport component ... In a form, for read from a serial port I write: Load { serialPort1.Close(); serialPort1.NewLine = "\r\n"; serialPort1.PortName = "COM18"; // GPS COM serialPort1.Open(); } in the dataReceived event, the app stopped with this error: cross-thread not true... private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { textBox1.Text = serialPort1.ReadLine(); //error line } Why error on thread-safe? Help me please (with example). Many thanks.
Alex
-
Hi All, I have a problem with a serialport component ... In a form, for read from a serial port I write: Load { serialPort1.Close(); serialPort1.NewLine = "\r\n"; serialPort1.PortName = "COM18"; // GPS COM serialPort1.Open(); } in the dataReceived event, the app stopped with this error: cross-thread not true... private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { textBox1.Text = serialPort1.ReadLine(); //error line } Why error on thread-safe? Help me please (with example). Many thanks.
Alex
-
Hi All, I have a problem with a serialport component ... In a form, for read from a serial port I write: Load { serialPort1.Close(); serialPort1.NewLine = "\r\n"; serialPort1.PortName = "COM18"; // GPS COM serialPort1.Open(); } in the dataReceived event, the app stopped with this error: cross-thread not true... private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { textBox1.Text = serialPort1.ReadLine(); //error line } Why error on thread-safe? Help me please (with example). Many thanks.
Alex
Hi, I have two articles that seem relevant: asyncpool1[^] crossthreads1[^] :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Happy New Year to all.
We hope 2010 soon brings us automatic PRE tags!
Until then, please insert them manually.
-
Hi, I have two articles that seem relevant: asyncpool1[^] crossthreads1[^] :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Happy New Year to all.
We hope 2010 soon brings us automatic PRE tags!
Until then, please insert them manually.
-
you're welcome. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Happy New Year to all.
We hope 2010 soon brings us automatic PRE tags!
Until then, please insert them manually.