09-01-2020 11:43 AM
Run the script below. I would expect IsObject() to report FALSE, not TRUE. I'm pretty sure that was the behavior prior to DIAdem 2020.
Call LogFileDel
Dim oArea
Call LogFileWrite(IsObject(oArea))
Set oArea = Nothing
Call LogFileWrite(IsObject(oArea)) 'This should be FALSE
Call LogFileWrite(TypeName(oArea))
'Results:
'FALSE
'TRUE
'Nothing
Solved! Go to Solution.
09-07-2020 05:06 AM
The
IsObject
is part of the VbScript implementation. I assume this never changed with DIAdem version.
So maybe it is because of changing return value of DIAdem API.
If so we would need more information.
to check for nothing you need
If oArea Is Nothing Then
09-23-2020 01:13 PM
Yeah Mark,
My memory is that IsObject(Nothing) has always returned TRUE. In the same way that IsNumeric(Null) has always returned TRUE and IsNumeric("") has always returned TRUE. The Nothing constant is a denormal constant of type object. Take Andreas' suggestion with the goofy "If oArea Is Nothing Then" syntax, and that will steer you right.
Regards,
Brad Turpin
Principal Technical Support Engineer
National Instruments
10-13-2020 06:16 PM
FYI.. I continue to experience inconsistent and unexpected behavior for IsObject and Is Nothing for objects in DIAdem 2020. I have had to create my own functions to check channel object and others, with excessive error trapping in order to achieve a reliable outcome. Something has changed, and it varies considerably by context.