[quoted text, click to view] "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:uyxyB0DGFHA.3840@tk2msftngp13.phx.gbl...
: Andy wrote:
: > Hi Gang
: >
: > I want to create a simple array that could have up to 100 - 200 rows
: > and that always has 2 columns (and will have some number value in each
: > column). I can't seem to figure out how to create the array
: > initially, increase the row size 1 by 1 and populate the values of
: > the array in a loop.
: >
: > Can you please help with the (I think) simple problem??
: >
: > Thanks
: > Andy
:
: In a multidemensional array, only the last dimension can be resized. So
you
: need to use your first dimension to denote columns, and the second to
denote
: rows, allowing you to do this:
:
: redim myarray(1, ubound(myarray,2) + 1)
:
:
: Having said that, if it is at all possible to figure out before the loop
how
: many rows will be added, you will gain considerable performance benefits
by
: defining the proper number of rows before the loop:
:
: dim myarray(), rows
: rows=CalcNumberOfRows()
: redim myarray(1,rows-1)
: 'run loop to fill array
:
: If you can't determine the exact number of rows, your second best option
is
: to size your array to some number greater than you will ever need:
:
: dim myarray(1,1000)
: 'run loop to fill array
:
: Then simply ignore the empty rows in your later code.
:
: Lastly, if you are filling the array from a recordset, you may be
: overlooking the easiest solution of all: GetRows
: (
http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthgetrows.asp).
Or a dictionary object...
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center -
http://www.microsoft.com/technet/scriptcenter/ WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp MSDN Library -
http://msdn.microsoft.com/library/default.asp