Share via


Type '<typename>' must define operator '<determinantoperator>' to be used in a '<shortcircuitoperator>' expression

An AndAlso Operator or an OrElse Operator uses operands of a class or structure type, when that class or structure does not define a required operator.

Because you do not define a short-circuiting operator (AndAlso or OrElse) directly, you must define the corresponding logical and determinant operators. The following table shows the required operators.

Short-circuiting operator

Logical operator

Determinant operator

AndAlso

And Operator (Visual Basic)

IsFalse Operator

OrElse

Or Operator (Visual Basic)

IsTrue Operator

Visual Basic uses these logical and determinant operators to construct the short-circuiting logic for AndAlso or OrElse. For this to work properly, both operands and the return value of your And or Or definition must be of the containing type, that is, the type of the class or structure in which you are defining And or Or.

Error ID: BC33035

To correct this error

  • Define the And and IsFalse operators, or the Or and IsTrue operators, in the class or structure used for the operand type of the AndAlso or OrElse operator. Be sure the operands for And or Or are of the type of the class or structure in which you define it.

See Also

Tasks

How to: Define an Operator

How to: Define a Conversion Operator

Concepts

Operator Procedures

Logical and Bitwise Operators in Visual Basic

Reference

Operator Statement