private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
byte[] result = new byte[serialPort1.BytesToRead];
serialPort1.Read(result, 0, serialPort1.BytesToRead);
foreach (byte b in result)
{
sb.Append((char)b);
}
AddTextToTxtbox at = new AddTextToTxtbox(addTextToTxtbox);
this.Invoke(at, sb.ToString());
/* this.Invoke((EventHandler)delegate(string msg)
{
this.richTextBox1.AppendText(msg);
},sb.ToString());*/
sb.Clear();
}
private void addTextToTxtbox(string msg)
{
richTextBox1.AppendText(msg);
}