Parameter types of '<operator>' must be '<typename>' to be used in a 'For' statement

A For loop specifies a counter variable of a type that does not define the >= or <= operator with parameters of its own type.

The counter variable must be of a type that supports greater-than-or-equal (>=) and less-than-or-equal (<=) operators that compare their containing type. This means both of the operands must be of the type of the counter variable.

If you use a numeric data type for the counter variable, the >= and <= operators are supported on the containing type. If you use a user-defined class or structure, you must define both operators with operands of the type of your class or structure.

Error ID: BC33040

To correct this error

  1. Make sure the spelling of the counter-variable data type is correct.

  2. If you are using a user-defined class or structure for the counter variable, define >= and <= operators that compare that class or structure.

See Also

Tasks

How to: Define an Operator

How to: Define a Conversion Operator

Concepts

Operator Procedures

Reference

For...Next Statement (Visual Basic)

Operator Statement