读书人

如果数组A有5个元素数组B有3个元素,

发布时间: 2012-10-21 09:00:07 作者: rapoo

如果数组A有5个元素,数组B有3个元素,for i=0 to Ubound(A);x = A(i);y=B(i) ;则就会出现数组越界的问题,r如何解决呀?


是的,如果数组A有5个元素,数组B有3个元素。
那么
for i=0 to Ubound(A)
x = A(i)
y=B(i)

则就会出现数组越界的问题

是呀,如何解决这个问题呀?

[解决办法]
方法1

for i=0 to Ubound(B)
x = A(i)
y=B(i)
Next

方法2

for i=0 to Ubound(A)
x = A(i)
If i <= Ubound(B) Then
y=B(i)
Else
y = ""
End If
Next
[解决办法]
on error resume next,不过孟子E章的方法更好些

读书人网 >ASP

热点推荐