how do redim a 2 dimesional array?

how do redim a 2 dimesional array?

Anonymous
Not applicable
357 Views
4 Replies
Message 1 of 5

how do redim a 2 dimesional array?

Anonymous
Not applicable
Dim arLayerData(100, 5) As String

was at first then i need to adjust the 100 to the real number of layers but
keep the 5 the same?
0 Likes
358 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
As far as I know an Dynamic Array must be first declared without bounds.

Dim asLayerData () as String

'then later add the bounds

ReDim arLayerData(50, 5) as string

'or if you wish to preserve existing info in the array use this

ReDim Preserve ArLayerData(70,5) as string

Leland Leahy wrote in message
news:F4D3097945D9079E904F504AD8FEF913@in.WebX.maYIadrTaRb...
> Dim arLayerData(100, 5) As String
>
> was at first then i need to adjust the 100 to the real number of layers
but
> keep the 5 the same?
>
>
0 Likes
Message 3 of 5

Anonymous
Not applicable
Hi,

One more restraint.

If you use REDIM PRESERVE you can only change the last parameter.

eg
dim ss() as integer
redim ss(5,0)
ss (5,0) = 2
for x = 1 to 200
redim preserve ss(5, 0 to i)
ss(5,i) = i
next i

You can't do
dim ss() as integer
redim ss(0,5)
ss (0,5) = 2
for x = 1 to 200
redim preserve ss( 0 to i, 5)
ss(i,5) = i
next i"


--
Regards


Laurie Comerford
CADApps
Paul H" wrote in message
news:49B890C023B5D3907FE38797FF408BD3@in.WebX.maYIadrTaRb...
> As far as I know an Dynamic Array must be first declared without bounds.
>
> Dim asLayerData () as String
>
> 'then later add the bounds
>
> ReDim arLayerData(50, 5) as string
>
> 'or if you wish to preserve existing info in the array use this
>
> ReDim Preserve ArLayerData(70,5) as string
>
> Leland Leahy wrote in message
> news:F4D3097945D9079E904F504AD8FEF913@in.WebX.maYIadrTaRb...
> > Dim arLayerData(100, 5) As String
> >
> > was at first then i need to adjust the 100 to the real number of layers
> but
> > keep the 5 the same?
> >
> >
>
>
0 Likes
Message 4 of 5

Anonymous
Not applicable
Laurie Comerford wrote:

> If you use REDIM PRESERVE you can only change the last parameter.

Yes, I lost nearly an hour until I finally read that in the help.

Terry
0 Likes
Message 5 of 5

Anonymous
Not applicable
Why don't you just reverse the order of your dimensions so that you can
resize as needed?
Dim arLayerData(5, 100) As String


"Terry W. Dotson" wrote in message
news:3B0EF3BD.6B9EF8FC@dotsoft.com...
> Laurie Comerford wrote:
>
> > If you use REDIM PRESERVE you can only change the last parameter.
>
> Yes, I lost nearly an hour until I finally read that in the help.
>
> Terry
0 Likes