REGULAR VARIABLES For each item of information that we wish to store we need to declare a seperate variable This can become very confusing if we have multiple items of the same type to store
To store 3 individual names we need to declare 3 seperate variables strName1 strName2 strName3
New method of storing information We can use a special type of variable  called an "Array" to store multiple items in a single variable We declare an Array very similar to a variable Dim strName (5)  as String The   (5)  represents the number of items  that we wish to store in our array
strName(5)  would look like this We refer to each individual cell in the array by its "INDEX" number An array starts with an index of 0
To place information into the first cell of the array we would do it as follows strName(0) = "Casey" To place information into the forth cell we would do the following strName(3) = "Roger"
Casey Roger To retrieve information from an array  and display it to a label we would do the following lblOutput.Caption = strName(  ) To display Casey we would write lblOutput.Caption = strName(0) To display Roger we would write lblOutput.Caption = strName(3)

Working With Arrays

  • 1.
    REGULAR VARIABLES Foreach item of information that we wish to store we need to declare a seperate variable This can become very confusing if we have multiple items of the same type to store
  • 2.
    To store 3individual names we need to declare 3 seperate variables strName1 strName2 strName3
  • 3.
    New method ofstoring information We can use a special type of variable called an "Array" to store multiple items in a single variable We declare an Array very similar to a variable Dim strName (5) as String The (5) represents the number of items that we wish to store in our array
  • 4.
    strName(5) wouldlook like this We refer to each individual cell in the array by its "INDEX" number An array starts with an index of 0
  • 5.
    To place informationinto the first cell of the array we would do it as follows strName(0) = "Casey" To place information into the forth cell we would do the following strName(3) = "Roger"
  • 6.
    Casey Roger Toretrieve information from an array and display it to a label we would do the following lblOutput.Caption = strName( ) To display Casey we would write lblOutput.Caption = strName(0) To display Roger we would write lblOutput.Caption = strName(3)