Declaration expected

A nondeclarative statement, such as an assignment or loop statement, occurs outside any procedure. Only declarations are allowed outside procedures.

Alternatively, a programming element is declared without a declaration keyword such as Dim or Const.

Error ID: BC30188

To correct this error

  • Move the nondeclarative statement to the body of a procedure.

  • Begin the declaration with an appropriate declaration keyword.

  • Ensure that a declaration keyword is not misspelled.

See Also

Concepts

Procedures in Visual Basic

Reference

Dim Statement (Visual Basic)