Advertisement

06.24.2007 at 07:41PM PDT, ID: 22654722
[x]
Attachment Details

Looping through Multi-dimensional arrays in VB Script

Asked by chico2 in Microsoft Visual Basic.Net, VB Script

Tags: array, dimensional, vb

Hi,

I'd like to create a two-dimensional array, and loop through it using VB Script.

Can anybody answer the following?
 - Is there any syntax for making one or more dimensions of a two dimensional array dynamic?  
 I'm okay with creating a static two dimensional, and a dynamic "regular" array- but I don't know how
to create a dynamic two dimensional.

- I need some help with the loop too.  In "pseudo-code" what I'd like to achieve is:

for each value in the first dimension of the array {
         for each value in the second dimension of the array{
                   Perform Action (I know what I want to do here)
         }
}

I was hoping there was loop type I could use that went through each element of each dimension of the
array, without having to "hard code" a static number of loops.  

Alternatively, I was after function that could determine the number of elements that had been populated in the array, which I could then assign to a variable and then loop through that many times (although I'd
prefer to loop through the other way if possible)

Any help appreciated.

Cheers,
Farfo.

Start Free Trial
 
 
[+][-]06.24.2007 at 08:11PM PDT, ID: 19353201

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual Basic.Net, VB Script
Tags: array, dimensional, vb
Sign Up Now!
Solution Provided By: PaulHews
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.24.2007 at 08:15PM PDT, ID: 19353207

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.24.2007 at 09:05PM PDT, ID: 19353345

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32