Constant expression is required

A Const statement does not properly initialize a constant, or an array declaration uses a variable to specify the number of elements.

Error ID: BC30059

To correct this error

  1. If the declaration is a Const statement, check to make sure the constant is initialized with a literal, a previously declared constant, an enumeration member, or a combination of literals, constants, and enumeration members combined with operators.

  2. If the declaration specifies an array, check to see if a variable is being used to specify the number of elements. If so, replace the variable with a constant expression.

See Also

Tasks

How to: Declare an Array Variable

Reference

Const Statement (Visual Basic)