Partager via


La variable ne peut pas être initialisée avec un type autre qu'un type tableau '<NomÉlément>'

Mise à jour : novembre 2007

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

Une variable déclarée en tant que tableau doit être initialisée avec une valeur de tableau.

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

ID d'erreur : BC36536

Pour corriger cette erreur

  • Initialisez la variable tableau avec une valeur de tableau :

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

Voir aussi

Tâches

Comment : déclarer une variable tableau