VB一个窗体能同时用几个MSCOMM控件
比如MSCOMM1,MSCOMM2,使用起来只要设置对应不同的COM口,就不会出现冲突吧!有没有具体而简单的实例呀~...
比如MSCOMM1,MSCOMM2,使用起来只要设置对应不同的COM口,就不会出现冲突吧!
有没有具体而简单的实例呀~ 展开
有没有具体而简单的实例呀~ 展开
展开全部
MSCOMM1,MSCOMM2不能同时使用同一个COM口,设置对应不同的COM口就不会出现冲突,
我以前写的一段如下:
MSComm.CommPort = Comboduankou.ListIndex + 1
MSComm.Settings = "9600,N,8,1"
MSComm.InputMode = comInputModeText
MSComm.RThreshold = 9
MSComm.SThreshold = 1
If MSComm.PortOpen = False Then
MSComm.PortOpen = True
End If
If MSComm.PortOpen = True Then
Shape1.BorderColor = vbRed
Else
Shape1.BorderColor = vbGreen
End If
Private Sub MSComm_OnComm()
Select Case MSComm.CommEvent
Case comEvReceive
MSComm.InputMode = 0
buffer = MSComm.Input
End Select
If buffer <> vbNullString Then
Textreceive = Textreceive & buffer & Chr(13) & Chr(10)
End If
End Sub
更多见:http://www.yu3zx.com/topic.asp?id=6&boardid=3&tb=1
我以前写的一段如下:
MSComm.CommPort = Comboduankou.ListIndex + 1
MSComm.Settings = "9600,N,8,1"
MSComm.InputMode = comInputModeText
MSComm.RThreshold = 9
MSComm.SThreshold = 1
If MSComm.PortOpen = False Then
MSComm.PortOpen = True
End If
If MSComm.PortOpen = True Then
Shape1.BorderColor = vbRed
Else
Shape1.BorderColor = vbGreen
End If
Private Sub MSComm_OnComm()
Select Case MSComm.CommEvent
Case comEvReceive
MSComm.InputMode = 0
buffer = MSComm.Input
End Select
If buffer <> vbNullString Then
Textreceive = Textreceive & buffer & Chr(13) & Chr(10)
End If
End Sub
更多见:http://www.yu3zx.com/topic.asp?id=6&boardid=3&tb=1
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询