如何创建数组并显示所需的数组值

时间:2017-04-23 16:27:06

标签: arrays vbscript qtp

如何创建数组并显示所需的数组值。例如:

编曲[0] ="阿南德" Arr [1] =" bala" .print Arr optin:2,Bala。

我需要所需的数组输出

1 个答案:

答案 0 :(得分:0)

Queat似乎有点不清楚。 可能是下面的一段代码可以相关你的问题。

'Initializing & Filling up array
Dim testArr(3)
testArr(0)="First"
testArr(1)="Second"
testArr(2)="Third"

Dim Iterator,userInput

'If you Need ro validate the User input you need to use Err Object.
'Like if it's number or not/Is teh User Provided value is positive or not/ etc. etc. which i'm not doing now)

userInput=Cint(inputbox("Please enter a Positive number between 1-" & Ubound(testArr)))

If userInput<=Ubound(testArr) Then
   MsgBox(testArr(userInput-1))
Else
    MsgBox("Wrong Value Provided. Not Applicable Array Index Number !!!")
End If      
相关问题