Friday, September 9, 2011

VBScript IsArray

VBScript IsArray
IsArray function indicates whether a specific variable is an array or not.

Example 1 of IsArray
Dim Var
Dim Arr(3)
Arr(0) = "Sunday"
Arr(1) = "Monday"
Arr(2) = "Tuesday"
Var = IsArray(Arr)
msgbox (Var) 'Var Shows "True"

Example 2 of IsArray
msgbox(a(3))'Shows 20
Var = IsArray(a)
msgbox (Var) 'Shows "True"

Example 3 of IsArray
Dim first_array() 'Declare an array with no upper limit, later you can use redim to reset the upper value.
Var = IsArray(first_array)
msgbox (Var) 'Shows "True"

Example 4 of IsArray
Dim myarray(3)
myarray(0) = 111
myarray(1) = 222
myarray(2) = 333
Erase myarray 'The Erase statement is used to "empty" arrays.
Var = 0
Var = IsArray(myarray)
msgbox (Var) 'Shows "True"
Var1 = ubound(myarray)
msgbox (Var1) 'Shows 3

Also See:
Complete List of VBScript Array Functions