分类:
2008-03-27 17:40:03
返回一个 Boolean 值,指示表达式是否未被指派对象。
Public Function IsNothing(ByVal Expression As Object) As Boolean
参数
如果表达式表示尚未被指派任何对象的 Object 变量,IsNothing 函数返回 True;否则,返回 False。
下面的示例使用 IsNothing 函数来确定对象变量是否与任何对象实例相关联。
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.