soumya p n

soumya p n

  • NA
  • 41
  • 0

Read SerialPort

Aug 5 2008 3:48 AM
Hello everyone,
I have a problem with reading SerialPort data.My code goes like this:
SerialPort sp = new SerialPort("COM3",9600,Parity.None,8,StopBits.One);
            sp.Open();
            sp.DtrEnable = true;
            sp.RtsEnable = true;    
            //byte[] data = new byte[sp.BytesToRead];
           //  int i = sp.Read(data, 0, data.Length);
            string val = sp.ReadExisting();
            textBox1.Text = sp.ReadExisting();
            sp.Close();
But it returns me thing.Output is just empty.
What would be the problem??
Thanks in advance,
Soumya

Answers (2)