Visual Basic Arrays
In Understanding Visual Basic Variable & Constant Types and Declaring Visual Basic Variables and Constants we looked at storing data (such as numbers, strings and boolean true or false values) in memory locations known as variables and constants. The variable types covered in those chapters were useful for storing one value per variable. Often, however, it is necessary to group together multiple variables into a self contained object. This is where the concept of Visual Basic Arrays comes in.
What is a Visual Basic Array
A Visual Basic array is an object that contains a specified number of items. Once you have grouped all the items into the array you can then perform tasks like sorting the array items into alphabetical or numerical order, accessing and changing the value assigned to each array item, and passing the group of items as a parameter to a Visual Basic Function or Subroutine (see Visual Basic Modules and Procedures) by passing just the array object.
In this chapter we will look in detail at how to create and manipulate both single and multidimensional Visual Basic arrays.