Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript arrays???

Status
Not open for further replies.

Oxymoron

Technical User
Dec 17, 2000
168
GB
hi all.
could anyone tell me how I would create a very simple array composed of 3 users for example.
they would enter their names in an inputbox, and if they existed within the array of users, they would get a msgbox for example.
I know the basics of an array, i.e. setting the amount of variables, ReDim, etc..but am having trouble on this simple project.
any and all comments greatly appreciated.
thanx!
JoE
 
Hello, Oxymoron.

Dim NameList, Input, i, flg
NameList = Array("John","Smith","Oxymoron")
Input = InputBox("Enter your name : -")
MsgBox ("You entered : " & Input)
flg = False
For i=0 To UBound(NameList)
If trim(Input) = NameList(i) Then
flg = True
Exit For
End If
Next
If flg Then
MsgBox ("Your name is accepted.")
{do_something}
Else
MsgBox ("Your name is not listed.")
{do something else}
End If

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top