Number of indices exceeds the number of dimensions of the indexed array

The number of indices used to access an array element must be exactly the same as the rank of the array, that is, the number of dimensions declared for it.

Error ID: BC30106

To correct this error

  • Remove subscripts from the array reference until the total number of subscripts equals the rank of the array. For example:

    [Visual Basic]
    Dim gameBoard(3, 3) As String
    
    ' Incorrect code. The array has two dimensions.
    gameBoard(1, 1, 1) = "X"
    gameBoard(2, 1, 1) = "O"
    
    ' Correct code.
    gameBoard(0, 0) = "X"
    gameBoard(1, 0) = "O"
    

See Also

Other Resources

Arrays in Visual Basic