Hi,
This is an old and commonly asked question. What you are seeing is that your data from the serial port is being received on another thread. The thread that is running the Windows UI is different. It's like two different machines running in the same house, but one has no idea how to deal with the other.
So you need what's called a delegate.
See the code below.
delegate void StringDelegate(string text);
private void SetText(string text)
{
if (this.richTextBox1.InvokeRequired)
{
StringArgReturningVoidDelegate d = new StringArgReturningVoidDelegate(SetText);
this.Invoke(d, new object[] { text });
}
else
{
this.richTextBox1.Text = text;
}
}