Udostępnij za pośrednictwem


Array initializers are valid only for arrays, but the type of '<variablename>' is '<typename>'

An attempt was made to initialize a non-array variable with a list of values.

Error ID: BC30679

To correct this error

  • Declare and initialize the variable as an array; for example:

    Dim intarray As Integer() = {1, 5, 9}

  • Initialize the variable as a single value; for example:

    Dim intvalue As Integer = 1

See Also

Concepts

Variable Declaration in Visual Basic

Reference

Dim Statement (Visual Basic)

Other Resources

Arrays in Visual Basic