Operators cannot be declared in Modules

An Operator Statement appears in a module definition.

You can define an operator as part of a class or a structure that you are defining. The operator must take that class or structure as at least one of its operands.

An operator must use an instance of a programming element as one of its operands, and only classes and structures have instances. Therefore, you cannot define an operator as part of any other programming element.

Error ID: BC33018

To correct this error

  • If you require an operation on the module, use a Function Statement (Visual Basic) to define a Function procedure that performs the operation.

  • You can also define a class or structure within the module and define an operator on that class or structure. However, that operator must take an instance of that class or structure as at least one of its operands.

See Also

Tasks

How to: Define an Operator

How to: Define a Conversion Operator

Concepts

Operator Procedures