vb6串口问题
求教
form界面里串口发送接收数据,关闭form界面后还在接受数据,再打开form界面报串口已打开错误,有什么好的方法可以避免吗?望各位指教
[解决办法]
Dim bClose As Boolean
-------------------------------------
while
DoEvents()
If bClose Then
MSComm1.PortOpen = False
Exit While
End If
......
wend
-------------------------------------
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
bClose = True
End Sub
[解决办法]
Do Until MSComm1.PortOpen = False
DoEvents()
Loop
MSComm1.PortOpen = True