Dynamically declare an array in VBScript

How to define an array dynamically in VbScript ?

Dim i,j
i= Inputbox("Enter array's dimension First one")

j= Inputbox("Enter array's dimension Second one")

i=Cint(i)
j=Cint(j)
These lines just convert the datatype by converting the data values from string type to integer type, simply because the Inputbox always returns data as string.

'The below definition does not work.
'Just because Vbscript does not have the feature to dynamically declare an array size
Dim array(i,j)

However the same can be attained by below line of code

Redim array(i,j)
What it does is redefine the array size at run time.
Just comment the earlier declaration.

1 comment:

  1. I constantly spent my half an hour to read this web site's posts every day along with a cup of coffee. aol email login

    ReplyDelete