Delen via


'For' loop control variable cannot be of type '<type>'

You have attempted to use a loop control variable that is not a valid type. At the beginning of a For loop, the start point, the end point, and the step value are evaluated in textual order. All three expressions must be implicitly convertible to the type of the variable. If the For loop variable is of type Object, then at least one of the expressions at run time must be of a numeric type, and all three expressions must be coercible to the widest numeric type among them.

Error ID: BC30337

To correct this error

  • Check the type of the loop control variable and change it to a valid one.

See Also

Reference

For (Visual Basic)

Do...Loop Statement (Visual Basic)

For...Next Statement (Visual Basic)