Constant expression is required

A Const statement doesn't 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.

  3. If the preceding checks don't address the issue, try setting the Const to a different temporary value, running the program, and then resetting the Const to the desired value.

See also