Imports System
Public Class Program
Public Shared Sub Main()
Dim array2d As Integer(,) = {
{ 1, 2, 3, 6, 0},
{-5, -4, 0, 7, 9},
{ 1, 18, 100, 14, 6},
{ 9, 10, 27, 12, 13}}
Dim array1d As Integer() = {1, 2, 3, 6, 0, -5, -4, 0, 7, 9, 1, 18, 100, 14, 6, 9, 10, 27, 12, 13}
Dim cols As Integer = array2d.GetUpperBound(1) + 1
Dim index As Integer = 17
Dim i As Integer = index / cols
Dim j As Integer = index - (i * cols) ' index Mod cols
Console.WriteLine("i = " & i & " j = " & j)
Console.WriteLine(array1d(index))
Console.WriteLine(array2d(i, j))
End Sub
End Class
' run:
'
' i = 3 j = 2
' 27
' 27
'