Tom Gullen
Tom Gullen

Reputation: 61729

Multidimension array in VB.net (ASP.net)

How do I create a multidimension array in VB.net? I want to specify the dimensions of the array in the code, but the array must be global.

Dim canvas()() As Integer

Then later on

x = someValue
y = someValue
canvas = New Integer(x)(y)

Cheers!

Upvotes: 1

Views: 595

Answers (2)

dbasnett
dbasnett

Reputation: 11773

One thing to note, arrays are zero based.

Dim foo(,) As Byte
Dim img As New Bitmap(8, 8)
ReDim foo(img.Width - 1, img.Height - 1)

Upvotes: 2

Tom Gullen
Tom Gullen

Reputation: 61729

Just worked it out

Dim canvas(,) As Integer
ReDim canvas(canvasWidth, canvasHeight)

Upvotes: 1

Related Questions