Impossibile inizializzare la variabile con il tipo non matrice '<nomeelemento>'

Aggiornamento: novembre 2007

Variable cannot be initialized with non-array type '<elementname>'

Una variabile dichiarata come matrice deve essere inizializzata con un valore di matrice.

' Not valid.
' The following line causes this error when executed with Option Strict off.
' Dim arrayVar1() = 10

ID errore: BC36536

Per correggere l'errore

  • Inizializzare la variabile di matrice con un valore di matrice:

    ' With Option Strict off.
    Dim arrayVar2() = {1, 2, 3}
    ' With Option Strict on.
    Dim arrayVar3() As Integer = {1, 2, 3}
    

Vedere anche

Attività

Procedura: dichiarare una variabile di matrice