我们公司的一个用VB源代码生成的上位机程序,别的控件功能都正常,只是一按起动会出现一个提示框,(运行时错误,8018,只有当端口打开时,操作有效,)源程序上会出现调试框显示黄色,内容如下,请懂VB的高手指教一下. Select Case KeyCode
Case 112 'F1
If bStop = False Then bStop = True
If Comm1.PortOpen = True Then
Comm1.PortOpen = False
Comm2.PortOpen = False
End
'用户接口,接受用户命令
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim oFso As New FileSystemObject
Dim cExit As Long
Dim cRecord As String '记录用户上次退出的行位置
Select Case KeyCode
Case 112 'F1装入文件
If bStop = False Then bStop = True
If Comm1.PortOpen = True Then
Comm1.PortOpen = False
Comm2.PortOpen = False
End If
Select Case KeyCode
Case 112 'F1装入文件
If bStop = False Then bStop = True
If Comm1.PortOpen = True Then
Comm1.PortOpen = False
Comm2.PortOpen = False
End If
改为:
Select Case KeyCode
Case 112 'F1装入文件
If bStop = False Then bStop = True
If Comm1.PortOpen Then Comm1.PortOpen = False
If Comm2.PortOpen Then Comm2.PortOpen = False