MScomm控件,串口通讯数组下标越界
各位高手,串口通讯出现的问题,大家帮忙看一下.数据少时正常,200左右好象还可以,大批数据就会出现下标越界的提示,下面是主要程序以及错误提示的行,各位高手看看是什么问题.
Dim X!(20000), Y!(20000)
StrPos = InStr(1, ReceiveStr, ",")
If StrPos = 0 Then Exit Do
ReceiveData(i) = Val(Left(ReceiveStr, StrPos - 1))
ReceiveStr = Right(ReceiveStr, Len(ReceiveStr) - InStr(1, ReceiveStr, ",")) 下标越界提示行
X(i) = i
Y(i) = ReceiveData(i)
If i = 0 Then
Graph1.PSet (X(i), Y(i))
Else
Graph1.Line -(X(i), Y(i))