Compares two object reference variables.
result = object1 Is object2
The Is operator determines if two object references refer to the same object. However, it does not perform value comparisons. If object1 and object2 both refer to the same object, result is True; if they do not, result is False.
This example uses the Is operator to compare two object references. The object variable names are generic and used for illustration purposes only. The result is a Boolean value representing whether the two objects are identical.
Dim myObject, otherObject As New Object Dim yourObject, thisObject, thatObject As Object Dim myCheck As Boolean yourObject = myObject thisObject = myObject thatObject = otherObject myCheck = yourObjectIs
thisObject ' Returns True. myCheck = thatObjectIs
thisObject ' Returns False. myCheck = myObjectIs
thatObject ' Returns False, if myObject is not thatObject.
Comparison Operators | Operator Precedence in Visual Basic | Operators Listed by Functionality |