登录
首页 PLC论坛 PLC论坛
回帖 发帖
正文

主题:求助用VB生成的上位机程序起动报8018如何解决

点击:3063 回复:6

我们公司的一个用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表情
11-01-07 13:37
comm2.portopen是不是这句.
没有true是不能用false的.错误的意思应该是,comm2.portopen应该先true,才可以false.
11-01-07 13:49
comPortNotOpen  8018  仅当端口打开时操作才有效  这是错误信息
Comm2.PortOpen = False 有误
楼上回复正确
11-01-07 14:10
'用户接口,接受用户命令
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
11-01-07 19:24
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
11-01-08 14:08
五楼的朋友,您的知识应该能帮我们公司搞定这;个程序,如果您有空的话,我发给你源代码,看能不能帮我们修改一下,我们之前源程序码可能是用串口通信的,现在我们要用以太网模块通信,不知您会在这程序上做一修改吗,,做好我们公司会给你一定的报酬的,
11-01-13 14:01
可以发来看看,同时要有以太网模块的详细资料。我的邮箱:lanting667@126.com
11-01-13 22:44

工控新闻

更多新闻资讯