曾经这个问题困扰我多天最后查资料一大堆,最后终于解决了,你要在com实例化的时候设置一个属性就可以
com = new SerialPort();
com.BaudRate = 19200;
com.PortName = "COM1";
com.DataBits = 8;
com.Parity = (Parity)0;
com.StopBits = 1;
com.WriteTimeout = 3000;
com.ReadTimeout = 3000;
com.ReceivedBytesThreshold = 1;
//必须一定要加上这句话,意思是接收缓冲区当中如果有一个字节的话就出发接收函数
com.DataReceived += new SerialDataReceivedEventHandler(com_DataReceived);
这个问题问了好多人都说的不对,最后突然在网上一片博文中发现的准备发一篇博文呢,还没有写呢,今天正好写一个