Visual Basic.net Arrays
Single Dimension Array An array is a series of individual variables, all referenced by the same name Sometimes arrays are referred to as tables or subscripted variables
Array Elements An example of a string array named strName strName(0) strName(1) strName(2) … *note each individual variable is known as an element of the array
Declaring an array (Syntax) Dim ArrayName([LowerSubscript to] UpperSubscript) [As DataType] Dim strName(0 to 9) as String ‘ 10 element array Dim curBalance(10) as Currency ‘ 10 element array Dim gstrProduct(1 to 100) as String ‘ 100 element array These are some examples of arrays declaration
String Array (example) Sam Neil John Wayne Casey Weldon Drew Barrymore Britney Spears Nicole Kidman Ashley Judd Nicolas Cage William Shatner Natalie Portman srtName(0 to 9)
Multiple Dimension Array Used to store two subscripts that Identifies tabular data, where data is arranged in rows and columns Examples: Insurance rate tables, tax tables, postage rates, etc.
Multidimensional Array (Syntax) Dim ArrayName (LowerLimit To] UpperLimit, [LowrrLimit To] UpperLimit) As Datatype Example: Dim strName(2, 3) As String Dim strName(0 to 2, 0 to 3) as String Both of these statements establishes an array of 12 elements
Multidimensional Array (Example) (0,0)(0,1)(0,2)(0,3) (1,0)(1,1)(1,2)(1,3) (2,0)(2,1)(2,2)(2,3) strName(0 to 2, 0 to 3)