Private Sub MSComm1_OnComm()
If Command2.Caption = "停止接受" Then
Select Case CommEvent
Case comEvReceive
temp = MSComm1.Input
ReDim Preserve temp(UBound(temp)) As Byte
For i = LBound(temp) To UBound(temp)
Text2 = Text2 & str$(temp(i)) & " "
Next i
End Select
End If
End Sub
usb/ppi電纜的發送信號和接受信號都亮起,但是沒有顯示到text2上,是代碼有問題還是其他什么原因,希望各位提供幫助,不甚感激~
uj5u.com熱心網友回復:
首先你得知道temp到底有沒有收到資料uj5u.com熱心網友回復:
If Command2.Caption = "停止接收" Then '首先檢查這里,字串是否與命令按鈕顯示的相同
Select Case CommEvent
Case comEvReceive
temp = MSComm1.Input
If MSComm1.InputMode=comInputModeText Then
Text2 = StrConv(temp, vbUnicode)
Else
For i = LBound(temp) To UBound(temp)
Text2 = Text2 & IIf(Text2 = "", "", " ") & Right("0" & Hex(temp(i)), 2)
Next i
End If
End Select
End If
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/120532.html
標籤:控件
下一篇:vb 列印報表時出錯
