This following code gives me an error that "Cross-thread operation not valid: Control 'textBox30' accessed from a thread other than the thread it was created on."
private void serialPort1_DataReceived(object sender,S ystem.IO.Ports.SerialDataReceivedEventArgs e)
{
int bytes = serialPort1.BytesToRead;
byte[] byte_buffer = new byte[bytes];
byte[] ar = new byte[20];
byte[] ssd = new byte[4];
byte[] ctrl = new byte[20];
string pp = "";
string ll = "";
serialPort1.Read(byte_buffer, 0, bytes);
int index = byte_buffer[0];
array[index] = TestSerializer.MarshalToStructureArray(byte_buffer,bytes);
textBox30.Text = index.ToString();
serialPort1.Write("N");
Thread.Sleep(1000);
}
Can any one Suggest a solution?