Mega Code Archive

 
Categories / VB.Net / Data Structure
 

Seclare a 4x3 Integer array

Imports System Public Class MainClass          Shared Sub Main()              Const rowsUB As Integer = 4              Const columnsUB As Integer = 3              Dim rectangularArray(rowsUB, columnsUB) As Integer              'populate the array              Dim i As Integer              For i = 0 To rowsUB - 1                  Dim j As Integer                  For j = 0 To columnsUB - 1                      rectangularArray(i, j) = i + j                  Next j              Next i              'report the contents of the array              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