Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

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

  1. At the left of the equal sign (=), specify the array name followed by parentheses.

  2. 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

Community Additions

ADD
Show:
© 2015 Microsoft