Visual Basic (2008 Express)
Two-dimensional arrays

In VB, two-dimensional arrays are declared using two subscripts.

Note again that the subscripts start from 0, so a two-dimensional array of real numbers with 2 rows and  3 columns such as ...

450.0

320.0

520.0
180.0 220.0 460.0

would be declared as in the example below...

Dim Sales(1, 2) As Single

Sales(0, 0) = 450.0
Sales(0, 1) = 320.0
Sales(0, 2) = 520.0
Sales(1, 0) = 180.0
Sales(1, 1) = 220.0
Sales(1, 2) = 460.0

 

 
 

   Back