Re: Playing with multidimensional array!?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks a lot for your help.

Correct me if I'm wrong (I really found that unusual!), but when accessing
data into the two dimensions array, the first parameters is always the
column, and the second one the row...

I'm always confused with that since others old programming languages are
functionning by beginning by the row...

"McKirahan" wrote:

"Claude Lachapelle" <ClaudeLachapelle@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:6F901599-03E5-4C95-BD8E-BAC64FE14AE2@xxxxxxxxxxxxxxxx
Hi!

I need to play with a multidimensional array in VBScript, but I`m about to
turn crazy with the way they are implemented into VBScript!

I need to start with an empty array, and start filling it with two
dimension
data like:

Row 1, Column 1 = mailbox.LegacyDN
Row 1, Column 2 = mailbox.ServerName
Row 1, Column 3 = mailbox.LastLogonTime
Row 1, Column 4 = mailbox.Size

Row 2, Column 1 = mailbox.LegacyDN
Row 2, Column 2 = mailbox.ServerName
Row 2, Column 3 = mailbox.LastLogonTime
Row 2, Column 4 = mailbox.Size

and so on... and after gathering all mailboxes informations on all
Exchange
Servers, I will be able to match Active Directory Users by seeking this
table
for the
corresponding ExchangeLegacyDN.

Actually, I'm defining the array with Dim aMailboxes(), and adding data to
it by using the REDIM PRESERVE, but where I'm really confused, it is how
the
REDIM the two dimension and after that, assigning values to the new Row
added... someone expert or familiar with that could help me?

You can only ReDim the last dimension (in your case "Rows");
thus, your array may look like:

Dim aMailboxes()
ReDim aMailboxes(3,0)
'* aMailboxes(0,#) = mailbox.LegacyDN
'* aMailboxes(1,#) = mailbox.ServerName
'* aMailboxes(2,#) = mailbox.LastLogonTime
'* aMailboxes(3,#) = mailbox.Size
Dim iMailboxes
iMailboxes = 0

ReDim Preserve aMailboxes(UBound(aMailboxes,1),iMailboxes)
aMailboxes(0,iMailboxes) = LegacyDN...
aMailboxes(1,iMailboxes) = ServerName...
aMailboxes(2,iMailboxes) = LastLogonTime...
aMailboxes(3,iMailboxes) = Size...
iMailboxes = iMailboxes + 1




.



Relevant Pages

  • Re: Using Redim on 2 dimensional array
    ... dimension can be changed. ... If Arr is a true varianttype array [e.g., ... Dim Arr() ... ReDim Preserve myArray ...
    (microsoft.public.excel.programming)
  • Re: Loading aan csv-file in a dynamic 2-dimensional Array
    ... > How do i use Redim preserve on a 2-dimensional Array. ... > Only the upper bound of the last dimension in a multidimensional array ... > dimension, a run-time error occurs. ...
    (microsoft.public.vb.enterprise)
  • Re: Loading aan csv-file in a dynamic 2-dimensional Array
    ... > How do i use Redim preserve on a 2-dimensional Array. ... > Only the upper bound of the last dimension in a multidimensional array ... > dimension, a run-time error occurs. ...
    (microsoft.public.vb.general.discussion)
  • RE: redim preserve behaves strange
    ... because it changes the first dimension of the array in a Redim Preserve ... Only the last dimension of an array can be changed in a Redim ... For Each oLine In n ActiveDocument.Sentences ...
    (microsoft.public.word.vba.general)
  • Re: Redim preserve f. 2-dim-Array
    ... "If you use the Preserve keyword, you can resize only the last array ... dimension and you can't change the number of dimensions at all." ... Bei der folgenden Befehlssequenz klappt das auch für die ersten ... ReDim Preserve ar ...
    (microsoft.public.de.vb)