Quote:
I need to display something when I receive a data. Could u tell me how to fix my code? I think invoking new EventHandler doesn't work correctly.
There is nothing to fix, you need to rewrite your code.
But first of all you need to understand how serial port is working. It is slooooow, very sloooooow, do not expect your data to wait in buffer instantly after opening the port.
Serial Comms in C# for Beginners[
^]
sPort.DataReceived += sPort_DataReceived;
The serial port object is not a storage space for the data, there is a buffer, but you can't use is to store some data.
Serial Port Communication Tutorial With C# Examples - CodeSamplez.com[
^]