dim butter() as byte
butter=comm1.input ’从串口接收,送到butter里
debug.print butter(1) ‘提示下标越界,为什么?好急啊
butter=comm1.input ’从串口接收,送到butter里
debug.print butter(1) ‘提示下标越界,为什么?好急啊
解决方案 »
- Microsoft Visual Studio 相应地设置 OutputPath 和 AssemblyName 属性设置
- 請問高手,關於一個文本文件搜索的問題
- 500分超高分,超难问题,REFEDIT 控件如何在VB6中正常使用?
- Excel中的非数值型累加复制如何实现?例如"A01B01"累加后成为"A01B02"、"A01B03"..."A01B100"
- 强烈要求删除所有不写出工作地点,待遇,要求的招聘广告
- 简单问题,请各位帮帮我这个菜鸟
- 请问各位大哥:一个难题
- 我想学编程请给点意见!
- VB6如何用代码让一个窗体即可以是子窗体也可以是模式窗体
- 哪位哥们谈谈VB+COM的开发,偶想了解这方面的知识。
- 请问有没有将一个对象通过网络发送的方法
- 我的星星如何能增回呀?是不是考核回答次数(刚来不知道)
butter=comm1.input 这里就会出现错误,说不能给数组赋值
dim butter() as byte
dim temp(33) as byte '我的程序来说,足够大了
dim lenth as integer
butter=comm1.input
lenth=comm1.inButtercount 'inbutter 的长度
for i=0 to lenth
temp(i)=butter(i) '给temp
next i
debug.print butter(1)
debug.print butter(1)出错的原因是因为没有input数据!
改为:
if lenth>1 then debug.print butter(1)
就可防错了
butter下标一般是从0开始的,所以至少要有2字节数据butter(1)才会有效
dim s() as byte
s = comm1.Input
debug.print s(0)
end if
debug.print com1.inbutterCount '输出21dim butter() as byte
dim temp(33) as byte '我的程序来说,足够大了
dim lenth as integer
butter=comm1.input
lenth=comm1.inButtercount 'inbutter 的长度 //这里lenth=21我单步调试的,可是看得到’//这里,我加上if了for i=0 to lenth
temp(i)=butter(i) '给temp //可是到了这里还是出错
next i
debug.print butter(1
非常抱歉没有看清楚,嘿嘿我想是因为 comm1.Input根本就没有返回内容的原因吧
有,我调试时,看得的到
不好是意思,我打错了
是inbuffercount,是MSComm空件
temp(i)=butter(i) '给temp //可是到了这里还是出错
next i
是不是应当是 length -1for i=0 to lenth - 1
temp(i)=butter(i) '给temp //可是到了这里还是出错
next i