SerialPort SeialPortcom = new SerialPort();
int Datenums = SeialPortcom.BytesToRead;
為什么 SeialPortcom.BytesToRead 顯示接收到資料個數 但是 int Datenums 沒有資料呢 小白 請教
uj5u.com熱心網友回復:
這代碼問題有點多,去搜一搜C# serialport的示例吧。連接前,需要指定具體的埠引數,比如埠名,波特率等等,如果動態創建serialport類,需要手動注冊資料接收事件,用委托來異步處理,發送最好也用異步。或者再簡單點,就直接用.net自帶的serialport控制元件,到屬性視窗里去配置必需的幾個屬性,然后從IDE自動創建事件去寫實作。
uj5u.com熱心網友回復:
嗯 串口配置波特率等都已配置好了int Datenums = SeialPortcom.BytesToRead;
SeialPortcom.BytesToRead資料個數可以看到了 但是int 中Datenums顯示0
uj5u.com熱心網友回復:
參考《編譯原理》中的詞法分析和有限狀態自動機。轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/50007.html
標籤:VB基礎類
上一篇:VB 畫lg坐標系,兩個縱軸
