Ⅰ VBS鍔ㄦ佹暟緇勭殑闂棰
i = 0: nStr = ""
Dim MyArray()
Do
a = InputBox("寰鐜鐩村埌杈撳叆4涓烘")
ReDim Preserve MyArray(i)
MyArray(i) = a
i = i + 1
Loop Until a = "4"
For i = 0 To UBound(MyArray)
nStr = nStr & MyArray(i) & ","
Next
MsgBox nStr
琛ュ厖錛--------------------------------------
涓嶄竴瀹氳 redim 鍚庢墠鑳界粰鏁扮粍璧嬪
Dim MyArray(5)
MyArray(0)=455
MyArray(1)=500
.......
鍥犱負榪欐椂鏁扮粍涓宸叉湁鍏冪礌 0 鍒 5 鍙
涓嬮潰鐨勭敤娉曞氨蹇呴』 redim 鍚庢墠鑳界粰鏁扮粍璧嬪
dim MyArray()'瀹氫箟鍔ㄦ佹暟緇勶紝姝ゆ椂鏁扮粍涓涓涓鍏冪礌閮芥病鏈
ReDim Preserve MyArray(3)'閲嶅畾涔夋暟緇勭殑鍏冪礌 涓 0 鍒 3 鍙
MyArray(0)=455
MyArray(1)=500
MyArray(2)=2
MyArray(3)=78
For i = 0 To UBound(MyArray)
nStr = nStr & MyArray(i) & ","
Next
琛ㄧず錛氬皢鏁扮粍鐨勬墍鏈夊厓緔犵敤瀛楃︿覆褰㈠紡榪炲湪涓璧鳳紝鐢ㄢ,鈥濆垎闅旓紝渚誇簬鏄劇ず銆
UBound(MyArray) 琛ㄧず鏁扮粍鍏冪礌鐨勬渶澶у簭鍙楓傚弬瑙侊細