发表于:2009/4/2 19:32:39
#0楼
Private Sub Command2_Click()
MSComm1.PortOpen = False
End
End Sub
Private Sub Form_Load()
Dim nowstring As Variant
Dim instring As String
MSComm1.CommPort = 4 '用MSCOMM控件的COMMPORT属性定义使用COM4口
MSComm1.Settings = "4800,N,8,1" '定义串口的数据格式:4800 bit/s,无奇偶效验位,8位数据,一个停止位
MSComm1.InputLen = 1 '空间读入整个缓冲区
MSComm1.RThreshold = 1 '当接收到一个字符后,触发ONCOMM事件
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvReceive '接收字符的事件触发
nowstring = MSComm1.Input
instring = instring + nowstring
txtRecive.Text1 = instring
End Select
End Sub
Private Sub 开始_Click()
MSComm1.Output = txtSend.Text2
End Sub
老是出现实时错误,"424" 要求对象?
希望知道的朋友说说?
MSComm1.PortOpen = False
End
End Sub
Private Sub Form_Load()
Dim nowstring As Variant
Dim instring As String
MSComm1.CommPort = 4 '用MSCOMM控件的COMMPORT属性定义使用COM4口
MSComm1.Settings = "4800,N,8,1" '定义串口的数据格式:4800 bit/s,无奇偶效验位,8位数据,一个停止位
MSComm1.InputLen = 1 '空间读入整个缓冲区
MSComm1.RThreshold = 1 '当接收到一个字符后,触发ONCOMM事件
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvReceive '接收字符的事件触发
nowstring = MSComm1.Input
instring = instring + nowstring
txtRecive.Text1 = instring
End Select
End Sub
Private Sub 开始_Click()
MSComm1.Output = txtSend.Text2
End Sub
老是出现实时错误,"424" 要求对象?
希望知道的朋友说说?
常胜者,既不过份悲观,也不过份乐观。他的危机意识是用来化除危机;他的希望源自于知道未来永远有好转的可能。