Private Sub Form_Activate()
Static idle1 As Integer
If idle1 Then Exit Sub
MSComm1.CommPort = 1
MSComm1.InBufferSize = 1024
MSComm1.InBufferCount = 0
MSComm1.InputLen = 0
MSComm1.RThreshold = 0
MSComm1.OutBufferSize = 512
MSComm1.OutBufferCount = 0
MSComm1.SThreshold = 0
If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True
End If
MSComm1.Output = "A"
End Sub为什么运行时会出现
MSComm1.Output =<Property is write-only>的错误呢?
请各位大虾帮忙解释一下
Static idle1 As Integer
If idle1 Then Exit Sub
MSComm1.CommPort = 1
MSComm1.InBufferSize = 1024
MSComm1.InBufferCount = 0
MSComm1.InputLen = 0
MSComm1.RThreshold = 0
MSComm1.OutBufferSize = 512
MSComm1.OutBufferCount = 0
MSComm1.SThreshold = 0
If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True
End If
MSComm1.Output = "A"
End Sub为什么运行时会出现
MSComm1.Output =<Property is write-only>的错误呢?
请各位大虾帮忙解释一下
代码修改如下:Private Sub Form_Activate()
Static idle1 As Integer
'If idle1 Then Exit Sub '此句代码条件无判断
If Not MSComm1.PortOpen Then
MSComm1.CommPort = 1
MSComm1.InBufferSize = 1024
MSComm1.InBufferCount = 0
MSComm1.InputLen = 0
MSComm1.RThreshold = 0
MSComm1.OutBufferSize = 512
MSComm1.OutBufferCount = 0
MSComm1.SThreshold = 0
MSComm1.PortOpen = True
End If
MSComm1.Output = "A"
End Sub