Visual Basic Language Reference  

IsNothing Function

Returns a Boolean value indicating whether an expression has no object assigned to it.

Public Function IsNothing(ByVal Expression As Object) As Boolean

Parameter

Expression
Required. Object expression.

Remarks

IsNothing returns True if the expression represents an Object variable that currently has no object assigned to it; otherwise, it returns False.

Example

This example uses the IsNothing function to determine if an object variable is associated with any object instance.

Dim MyVar As Object   ' No instance assigned to this variable yet.
Dim MyCheck As Boolean
' ...
MyCheck = IsNothing(MyVar)   ' Returns True.
' ...
MyVar = "ABCDEF"   ' Assign a string instance to the variable.
MyCheck = IsNothing(MyVar)   ' Returns False.
' ...
MyVar = Nothing   ' Disassociate the variable from any instance.
MyCheck = IsNothing(MyVar)   ' Returns True.

See Also

IsArray Function | IsDate Function | IsDBNull Function | IsError Function | IsNumeric Function | IsReference Function | Object Data Type | TypeName Function | Nothing