Results 1 to 7 of 7

Thread: An array of 2D arrays... how to create and reference??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2003
    Posts
    29

    An array of 2D arrays... how to create and reference??

    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

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    uuh you just mean something like this?
    dim arr(3,3) as integer ' 4x4 array

    arr(0,3) =199999999999999999999999999999999999 'overflow
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2003
    Posts
    29
    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

  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    what mr polite said is correct

    VB Code:
    1. dim arr(9,9) as integer
    will create 10 arrays of an array of 10 integers
    \m/\m/

  5. #5
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    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

    when using Redim, yuo can use Redim Preserve to make sure the content of the array isnt deleted
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Feb 2003
    Posts
    29
    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

  7. #7
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    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
    well make it 3d

    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
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width