O'Reilly logo

Visual Basic® .NET by Example by Bob Donald, Gabriel Oancea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Arrays

You have seen how a variable of a given data type is but a name for a memory location that can store a value of that type. Now what would you do if you would like to have a whole bunch of values of the same type stored as compact as possible and have the same name and some indexing scheme to be able to identify any given value? The answer is quite simple: you would have an array.

For example let's consider that you need to operate on five accounts, namely on the balances of these accounts. You could declare a variable for each account that will hold the balance for that account, as in the following example:

Dim balance1 As Decimal
Dim balance2 As Decimal
Dim balance3 As Decimal
Dim balance4 As Decimal
Dim balance5 As Decimal

Or you could ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required