0

hi everyone
I have array of two dimension but I don't know the size of the array, every time the size of array is change. I used (redim Preserve) but it change only the last dimension and I want to change the first dimension of array. please help meeee

3
Contributors
4
Replies
17
Views
3 Years
Discussion Span
Last Post by Shark_1
0

You can redimention the last element to change the size of the dynamic array.
For one-dimention array

ReDim Preserve DynamicArray(DynArray.GetUpperBound(0) + 1)

For Two-dimention array

ReDim Preserve DynamicArray(4, DynArray.GetUpperBound(1) + 1)

For Three-dimention array

ReDim Preserve DynamicArray(2, 4, DynArray.GetUpperBound(2) + 1)

GetUpperBound(2) rerurns the upperbound of the array element.
GetLowerBound(0) returns the lowerbound of the array element.
0 - denotes for the First Element
1 - denotes the Second Element
2 - denotes the Third Element.

Edited by Shark_1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.