Method: IsNull for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: IsNull for VBS
Method: IsNull for VBS
Specifies whether an expression contains invalid values (Null)
vIsNull = Object.IsNull(expression)
| Object | VBS Object with this method. You do not need to specify this object. |
| expression | Variant Specifies any expression. |
| vIsNull | Variant The IsNull method returns True if the expression contains invalid data. Otherwise the method returns False. In contrast to the value Null, the value Empty indicates that a variable has not yet been initialized. |
The following example checks whether a variable contains invalid values:
Dim MyVar Call MsgBox(IsNull(MyVar)) 'Returns False MyVar = Null Call MsgBox(IsNull(MyVar)) 'Returns True MyVar = Empty Call MsgBox(IsNull(MyVar)) 'Returns False Set MyVar = Nothing Call MsgBox(IsNull(MyVar)) 'Returns False