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

Recommended Answers

All 4 Replies

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.

thank for answer I solved the problem

If it solve your problem, please make it as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.