isnothing() 的用法解决思路
isnothing() 的用法
在网上查了一大堆用isnothing()判断是否为空值的用法,比如:
Dim testVar As Object
' No instance has been assigned to variable testVar yet.
Dim testCheck As Boolean
' The following call returns True.
testCheck = IsNothing(testVar)
' Assign a string instance to variable testVar.
testVar = "ABCDEF"
' The following call returns False.
testCheck = IsNothing(testVar)
' Disassociate variable testVar from any instance.
testVar = Nothing
' The following call returns True.
testCheck = IsNothing(testVar)
为什么我使用的时候却提示“函数未定义”呢,实际上VB中没有这个函数吧?
------解决思路----------------------
在网上查了一大堆用isnothing()判断是否为空值的用法,比如:
Dim testVar As Object
' No instance has been assigned to variable testVar yet.
Dim testCheck As Boolean
' The following call returns True.
testCheck = IsNothing(testVar)
' Assign a string instance to variable testVar.
testVar = "ABCDEF"
' The following call returns False.
testCheck = IsNothing(testVar)
' Disassociate variable testVar from any instance.
testVar = Nothing
' The following call returns True.
testCheck = IsNothing(testVar)
为什么我使用的时候却提示“函数未定义”呢,实际上VB中没有这个函数吧?
------解决思路----------------------
'是个语句,不是函数,并且是is Nothing,两单词之间有空格,不是连在一起的。比如
Dim col As Collection
If col Is Nothing Then
'如果未定义
Else
'否则
End If