ReDim Preserve Multidimensional Array

ell

Member
Joined
May 26, 2009
Messages
8
Programming Experience
Beginner
Can someone provide me with a function to redim preserve a multidimensional array (2d) and change both dimensions, also it would be a great help if someone could explain this function learly so i will be able to understand how it works, thanks in advance, ell.:)
 
Declare the array:
VB.NET:
Dim Arr(,) As Integer
Reset the size, 2 dimensions 0-10 for each, this also erases all data(if any):
VB.NET:
ReDim Arr(10,10)
Reset the size, while preserving any data if growing, else losing data at the eliminating elements if size is smaller:
VB.NET:
ReDim Preserve Arr(10,15)
Using an ArrayList or a generic List(of T) add data and grow or shrink as needed and perform better than ReDiming Arrays.
 
Thanks, I did go over to arraylists, they seem alot handier and moe convenient, also you get an error while rediming any dimension other than the farmost, thanks!
 
My favorite is the generics List(of T), as they can be any object you wish to store, even classes.
 
Back
Top