Array in VBScript?

Results 1 to 4 of 4

Thread: Array in VBScript?

  1. #1
    EvE Guest

    Default Array in VBScript?

    Hi, I am temporarily without an MSDN (can&#039t do scripting lookups!). <BR>Could anyone tell me if there is such a thing as an array in VBScript?<BR>I need a fairly small one (3-5 records max).<BR><BR>Thanks in advance<BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    43

    Default RE: Array in VBScript?

    i think this is how you can do arrays<BR>to declare it:<BR>Dim nameOfArray(no.of records)<BR><BR>if you do not know how many records you are going to have when you declare it then:<BR>Dim nameOfArray()<BR><BR>then when you know how many<BR>ReDim nameOfArray(no of records)<BR><BR>you can use loops to fill up the array with data or initialize it like this:<BR>nameOfArray = Array("item1", "item2"......)<BR><BR>HTH<BR>katie

  3. #3
    Vidya Guest

    Default RE: Array in VBScript?

    Hi EVE,<BR>There is a concept of arrays in VBSCRIPT.<BR>for eg: let us assume that u want an array that displays years from 1999 to 2001.<BR><BR>First declare the array<BR>Dim Year(2)..or if u wanna dynamic array then declare it as<BR>Dim Year()..<BR>But in case of a dynamic array u must know the upper bound of the array at some point of time..<BR>Say..u are knowing the upper limit of the array as x.<BR>You must redim the dynamic array.<BR><BR>Redim(x) where x is an integer.In our case X is 2.<BR><BR>Year(0)="1999"<BR>Year(1)="2000"<BR>Year (2)="2001"<BR><BR>U can now loop thro the array to get the values..<BR>

  4. #4
    EvE Guest

    Default RE: Array in VBScript?

    Thank you katie & Vidya!<BR>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •