VB编程用redim preserve重新定义数组维数,为什么会产生错误?一定要用array函数定义原数组么?
PrivateSubForm_Click()Dima(),i%a=Array(0,1,2,3,4,5,6,7,8,9)ReDimPreservea(10)a(10)=10...
Private Sub Form_Click()
Dim a(), i%
a = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
ReDim Preserve a(10)
a(10) = 10
For i = 0 To 10
Print a(i);
Next i
End Sub=================以上这样运行正确 =================以下是产生错误的代码Private Sub Form_Click()
Dim a(), i%
for i=0 to 9a(i)=inext i
ReDim Preserve a(10)
a(10) = 10
For i = 0 To 10
Print a(i);
Next i
End Sub小白菜求高人详解。。。。 展开
Dim a(), i%
a = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
ReDim Preserve a(10)
a(10) = 10
For i = 0 To 10
Print a(i);
Next i
End Sub=================以上这样运行正确 =================以下是产生错误的代码Private Sub Form_Click()
Dim a(), i%
for i=0 to 9a(i)=inext i
ReDim Preserve a(10)
a(10) = 10
For i = 0 To 10
Print a(i);
Next i
End Sub小白菜求高人详解。。。。 展开
2013-09-17
展开全部
Private Sub Form_Click()
Dim a(), i%
Redim a(9)'在这里加上这一句
for i=0 to 9
a(i)=i
next i
ReDim Preserve a(10)
a(10) = 10
For i = 0 To 10
Print a(i);
Next i
End SUB
Dim a(), i%
Redim a(9)'在这里加上这一句
for i=0 to 9
a(i)=i
next i
ReDim Preserve a(10)
a(10) = 10
For i = 0 To 10
Print a(i);
Next i
End SUB
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询