How to: Put a Value into an Array
You can store one of an array's values by using the array name and the appropriate indexes to specify the individual element.
To put a value into an array element
At the left of the equal sign (=), specify the array name followed by parentheses.
Inside the parentheses, include an expression for each index corresponding to the element you want to store. You need one index for each array dimension. The following example shows some statements that store values in arrays.
Dim numbers() As Integer
Dim matrix(,) As Double
numbers(i + 1) = 0
matrix(3, j * 2) = j
For each array dimension, the GetUpperBound method returns the highest value the index can have. The lowest index value is always 0.
See Also
Tasks
How to: Declare an Array Variable
How to: Initialize an Array Variable
How to: Get a Value from an Array
How to: Locate an Element in an Array in Visual Basic
How to: Reverse the Contents of An Array in Visual Basic
How to: Sort An Array in Visual Basic
Concepts
Array Dimensions in Visual Basic