Faqts : Computers : Programming : Languages : Visual basic

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

62 of 72 people (86%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

isNothing() function is not in the <All Libraries> <globals> list. Getting Compile error. Any ideas?

Dec 27th, 2003 07:26
Gary Winey, Tim Brown, Alex R,


isNothing() isn't a function (in VB6 at least)
try the expression:
X Is Nothing
rather than:
isNothing(X)
Like you, I tend to forget there is no intrinsic IsNothing function so 
I wrote my own as below:
Public Function IsNothing(pvar As Variant) As Boolean
   On Error Resume Next
   IsNothing = (pvar Is Nothing)
   Err.Clear
   On Error GoTo 0
End Function
The reason I relied entirely on error checking instead of using 
IsObject, etc. is because IsNothing(Nothing) needs to return True.