Export (0) Print
Expand All
Expand Minimize

Operands of type Object used for operator '<operatorsymbol>'; use the 'IsNot' operator to test object identity 

An expression uses the <> operator with one or both operands of the Object Data Type.

You should use the Is or IsNot operator to determine whether two object references refer to the same object instance. See "Comparing Objects" in Comparison Operators in Visual Basic.

When a variable or expression evaluates to Object, the compiler must perform late binding, which causes extra operations at run time. It also exposes your application to potential run-time errors. For example, if you assign a Form to an Object variable and then try to use it with the <> operator, the runtime throws an InvalidCastException because Visual Basic cannot convert a Form object to a data type suitable for value comparison. Even if both operands evaluate to type Form, the operation fails because <> is not defined for Form operands.

By default, this message is a warning. For information on hiding warnings or treating warnings as errors, see Configuring Warnings in Visual Basic.

Error ID: BC42032

To correct this error

  • If you want to determine whether two object references refer to the same object instance, use the Is or IsNot operator.

See Also

Community Additions

ADD
Show:
© 2015 Microsoft