Testing object references

You use the Is operator to compare object references and to test object reference variables for the value NOTHING. When you do, the expression evaluates to True if they refer to the same object, or if both have the value NOTHING, and evaluates to False if they don't.

Note: Do not use the IsNull(...) function with an object reference variable argument. It will always return a value of False.

This example tests object references:

Class MyClass
 ' ...
End Class

Dim x As MyClass
Dim y As MyClass
Dim z As New MyClass
Dim other As New MyClass

Set x = z
If (x Is z) Then  
   Print "Both x and z refer to the same object."
If (y Is NOTHING) Then 
   Print "y is NOTHING. It refers to no object."
If (z Is other) Then
   Print "This should not print; z and other are" & _
  " different objects."
End If

You can also use the Is operator in a flow of control statement, for example in a Do statement:

Dim a As New MyClass, b As MyClass
' ...
Do While b Is NOTHING      ' The condition b is NOTHING.
                           ' Condition is either True or False.
' ...
  Set b = a
Loop

Language cross-reference

Built-in constants in LotusScript® language

Working with object reference variables