标题: 求组VBS数组问题 [打印本页] 作者: hllxb_627 时间: 2011-9-18 00:01 标题: 求组VBS数组问题 要定义一个动态数组a(i),i的大小有代码inputbox("i"),利用循环将a(0)-a(i)的值一个一个的inputbox进去,msgbox 数组a(i)里面所有的值。
我刚学VB,好多问题陷入死胡同,逻辑上看的懂,按照逻辑去写,又写不出来,求大侠们帮帮忙指导下!
谢谢。作者: 海子 时间: 2011-9-19 11:39
Dim i
i=0
Do While True
number=InputBox("Please input a number,input 'Q' to quit","Inputbox")
If IsNumeric(number)and number<>"" Then
ReDim Preserve a(i)
a(i)=number
i=i+1
ElseIf number="Q" Then
MsgBox "The statement is finish now "
Exit Do
Else
MsgBox "Sorry,the number format is failed,Quit now"
Exit Do
End If
Loop
If IsEmpty(a) Then
MsgBox "The array is null,Quit "
Else
For j=LBound(a) To UBound(a)