naouf gyd
public partial class Form1 : Form
{ public SerialPort mySerialPort = new SerialPort("COM5");
public Form1()
{ InitializeComponent();
mySerialPort.DataReceived += new SerialDataReceivedEventHandler(DataR);
mySerialPort.Open();
}
public void DataR(object sender, SerialDataReceivedEventArgs e)
{ if (richTextBox1.InvokeRequired)
{ richTextBox1.Invoke(new SerialDataReceivedEventHandler(DataR), sender, e);
else
{
richTextBox1.AppendText(mySerialPort.ReadExisting()); //recieve data in real time.
private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{ }