Ad space (banner)
๐Ÿ”ทVB.NET Lessons
Lesson 24 / 68

Two-dimensional arrays (tabular data)

This lesson covers two-dimensional arrays in VB.NET, with the aim of handling data in table form.

Dim name(,) As Type declares a two-dimensional array. It suits data with rows and columns — a grade table, coordinates, anything you want to manage along two axes.

The sample code declares two rows by three columns as grid(,) As Integer = {{1, 2, 3}, {4, 5, 6}} and reaches a value with a comma-separated row and column, as in grid(1, 2). Note the nested For statements that display the whole thing.

A common early stumble is the order of the two indexes. grid(1, 2) means row 1, column 2, and confusing which is which gets you the wrong value.

In professional work, two-dimensional arrays are used for grid-shaped information — spreadsheet data, a game board.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run VB.NET directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)