In Visual Basic 6, is there anyway to tell if a variable passed into a function is an object? I want to be able to test if the variable is null, nothing or empty but only objects can be tested using "Is Nothing". Any ideas?
How is the function defined?
If it's ... As Object
then it's either a valid object or Null
.
If it's ... As Variant
(or no type) then anything can be passed and you can check using IsEmpty()
, IsNull()
(Note, NOT a null object, but a null value) or IsObject()
depending on what exactly you want to check for before the ... Is Nothing
check.
If the parameter is Optional
then you can use IsMissing()
but it must be a variant type with no default value.
Also, check out this article on the various uses of Null in VB.
IsObject(variable)
Not difficult to find
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With