Define and Init two dimensional array
Imports System
Public Class MainClass
Shared Sub Main(ByVal args As String())
Const rowsUB As Integer = 4
Const columnsUB As Integer = 3
' define and initialize the array
Dim rectangularArray As Integer(,) = _
{{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {9, 10, 11}}
' report the contents of the array
Dim i As Integer
For i = 0 To rowsUB - 1
Dim j As Integer
For j = 0 To columnsUB - 1
Console.WriteLine( _
"rectangularArray[{0},{1}] = {2}", _
i, j, rectangularArray(i, j))
Next j
Next i
End Sub
End Class
Related examples in the same category