| 发表于:2007-03-01 13:57:16 楼主 |
public byte[] read(int numbytes) { byte[] bufbytes; byte[] outbytes; bufbytes = new byte[numbytes]; if (hcomm != invalid_handle_value) { overlapped ovlcommport = new overlapped(); int bytesread = 0; readfile(hcomm, bufbytes, numbytes, ref bytesread, ref ovlcommport); outbytes = new byte[bytesread]; array.copy(bufbytes, outbytes, bytesread); } else { throw (new applicationexception( "串口未打开! ")); } return outbytes; } 上面的是从串口读数据 怎么样将读到的数据放入textbox.text里 |
|
|
|
|