I am trying to create an array of 2D arrays and dont have the slightest idea of how to start. Does anyone have any code that utilizes an array of 2D arrays. It would be a big help.
Thanks,
brazilnut
Printable View
I am trying to create an array of 2D arrays and dont have the slightest idea of how to start. Does anyone have any code that utilizes an array of 2D arrays. It would be a big help.
Thanks,
brazilnut
uuh you just mean something like this?
dim arr(3,3) as integer ' 4x4 array
arr(0,3) =199999999999999999999999999999999999 'overflow :)
I may be thinking about something Ive done in C++ before... I had an array of pointers. Each pointer pointed to a 2D array. Is this possible.... If not, here is my problem...
I need a dynamic number of 2D arrays at run time... this number could be 5 or 200.... I was thinking I could setup an array of 2D arrays and simply ReDim when I knew the exact size at execution.
thanks for the reply,
brazilnut
what mr polite said is correct
will create 10 arrays of an array of 10 integersVB Code:
dim arr(9,9) as integer
hmm wouldnt an array of 2D arrays be just a 3D array?
you dont have pointers in VB.. you can use C# if youre looking for pointers :rolleyes:
when using Redim, yuo can use Redim Preserve to make sure the content of the array isnt deleted
How would you go about creating a dynamic number of 2D arrays at run time... this number could be 5 or 200.
I am trying to avoid this:
Dim temp2DArray1 (,) As Double
Dim temp2DArray2 (,) As Double
Dim temp2DArray3 (,) As Double
Dim temp2DArray4 (,) As Double
Dim temp2DArray5 (,) As Double
Dim temp2DArray6 (,) As Double
etc.... could need up to 200 or more of these
well make it 3dQuote:
Originally posted by brazilnut52
How would you go about creating a dynamic number of 2D arrays at run time... this number could be 5 or 200.
I am trying to avoid this:
Dim temp2DArray1 (,) As Double
Dim temp2DArray2 (,) As Double
Dim temp2DArray3 (,) As Double
Dim temp2DArray4 (,) As Double
Dim temp2DArray5 (,) As Double
Dim temp2DArray6 (,) As Double
etc.... could need up to 200 or more of these
dim myArr( ,,) as double
redim preserve myArr(someNewSize)
I think redim has some limitations when it comes to arrays other than 1D. maybe you can only resize the first dimension? in this case you would have to have the dimensions of your 2D arrays fixed. Resizing the first dimension would change the number of 2D arrays in your 3D array, if that makes sense
but I dont know a good way to do this, maybe you should wait and see if anyone comes with a better answer