2 dimensional Arrays in Visual Basic

Two dimensional arrays are arranged in the form of rows and columns.

Example

Module Module1

    Sub Main()

        ' Create a 4 x 2 array (a grid with four rows and two columns).
        Dim IntArray(,) As Integer = {{1, 2}, {3, 4}, {5, 6}, {7, 8}}

        ' Iterating via for loop
        For Each sElement As String In IntArray
            Console.WriteLine(sElement)
        Next

        Console.ReadLine()

    End Sub

End Module
Share

You may also like...