Operator '<operatorname>' is not defined for types '<typename1>' and '<typename2>'

Operator '<operatorname>' is not defined for types '<typename1>' and '<typename2>'. Use 'Is' operator to compare two reference types.

An attempt was made to use an operator in a way that is inappropriate for the specified types. This error can be caused by using the "=" operator instead of using the Is operator to compare two objects.

Error ID: BC31080

To correct this error

  1. Use Is operator to compare two reference types.

  2. Use the Not operator in conjunction with the Is operator to denote inequality. For example:

    If Not A Is B Then
    

See Also

Reference

Is Operator (Visual Basic)

= Operator (Visual Basic)

Not Operator (Visual Basic)