本人vb初学者,有个问题希望高手看一下:
现在做个通过串口采集下位仪表的小程序,单步运行的时候能采集到值,可是全部运行就出现错误:实时错误 '5'
无效的过程调用或参数然后我点“调试”按钮,就进入到:Function RecvCmdCom(buf As String) As String
Dim strRead As String
Dim intBeginBit As Integer
Dim intEndBit As Integer
intBeginBit = InStr(1, buf, ",")
intEndBit = InStr(intBeginBit, buf, ":")
strRead = Mid(buf, intBeginBit + 1, intEndBit - intBeginBit - 1)
RecvCmdCom = Str(Val("&H" & strRead))
End Function光标停在strRead = Mid(buf, intBeginBit + 1, intEndBit - intBeginBit - 1)
这个语句上。请问各位高手,这个这么解决呢?是什么原因?
现在做个通过串口采集下位仪表的小程序,单步运行的时候能采集到值,可是全部运行就出现错误:实时错误 '5'
无效的过程调用或参数然后我点“调试”按钮,就进入到:Function RecvCmdCom(buf As String) As String
Dim strRead As String
Dim intBeginBit As Integer
Dim intEndBit As Integer
intBeginBit = InStr(1, buf, ",")
intEndBit = InStr(intBeginBit, buf, ":")
strRead = Mid(buf, intBeginBit + 1, intEndBit - intBeginBit - 1)
RecvCmdCom = Str(Val("&H" & strRead))
End Function光标停在strRead = Mid(buf, intBeginBit + 1, intEndBit - intBeginBit - 1)
这个语句上。请问各位高手,这个这么解决呢?是什么原因?
解决方案 »
- 如何打开TEXT1内容的程序?
- 在VB中,让一个打开的窗体慢慢的消失(也就是缓缓的自动关闭),该如何写代码?
- 这种功能要不要动态生成对象来实现,可以实现吗?
- 请各位编程高手教教小弟个VB问题哈,谢谢拉~!
- 怎么得到一个桌面的路径,(不要用控件或第三方的控件)
- 菜鸟请教,可以用hide和show实现的为什么要用创建新的对象呢,哪个比较好一些
- Fso如何实现有通配符的文件操作??如:copy pb*.* ,del pb28??.exe
- vb.net如何让一个textbox只能输入数字?
- VB可以控制U盘吗
- 有請zmazmapk(安安)及各路高手幫我解決此問題﹗
- 能用VB做一个可以把exe程序读入为地址+机器码+汇编指令形式的格式吗?
- 努力了!可是天意难为!程序员??怎么走`
Dim intBeginBit As Integer
Dim intEndBit As IntegerintBeginBit = InStr(1, buf, ",")'这句加个判断
if intBeginBit = 0 then '如果buf 中没有"," ,那么
RecvCmdCom=""
exit function
end if
intEndBit = InStr(intBeginBit, buf, ":")'这句加个判断
if intEndBit = 0 then '如果buf 中没有":" ,那么
RecvCmdCom=""
exit function
end if
strRead = Mid(buf, intBeginBit + 1, intEndBit - intBeginBit - 1)RecvCmdCom = Str(Val("&H" & strRead))End Function