Reply To: GUI does not work properly
› Forums › Graphical User Interface using C#, VB, HTML, ASP.NET Discussions › GUI does not work properly › Reply To: GUI does not work properly
Thanks, Bitahwa. Finaly I moved forward but unfortunately ony half step. Now I started getting data from terminal. The new problem is that data I can see on MessageBox. The next line gives me message:
“An unhandled exception of type ‘System.InvalidOperationException’ occurred in System.Windows.Forms.dll
Additional information: Cross-thread operation not valid: Control ‘rtxtDataArea’ accessed from a thread other than the thread it was created on.”
What are those two different threads?
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
string receivedData = ComPort.ReadExisting(); //read all available data in the receiving buffer.
// Show in the terminal window
//rtxtDataArea.ForeColor = Color.Green; //write text data in Green
rtxtDataArea.AppendText(receivedData + "\n");