Isnull, Isempty, isnumeric, isdate, ismissing.. is there any function that i can get if a reference val is set? I have tried if object=nothing then but get's "invalid use of object".
Printable View
Isnull, Isempty, isnumeric, isdate, ismissing.. is there any function that i can get if a reference val is set? I have tried if object=nothing then but get's "invalid use of object".
What do you mean by a reference Val Being set?
Dim a as blablaclass
Dim b as new blablaclass
If isnotset(a) then msgbox "a Is not set"
set a=b
If not isnotset(a) then msgbox "a Is set"
I still don't get what you mean by is set, do you mean if the variable contains a class or not
Ie
returns falseCode:Dim a as clsMyClass
IsSet (a)
andreturns trueCode:Dim a as New clsMyClass
IsSet (a)
I have a Temporar solution but I don't like it:
I don't know if it should work with all classes (what about those that have no default value)Code:Function Isnotset(test) As Boolean
On Error Resume Next
temp = test
If Err = 91 Then Isnotset = True
End Function
Isnt there an "isObject" function that might help?
No, i've tried all Isblabla allready
Kedaman, you were on the right track in the first place, your problem is just the syntax (use the Is keyword instead of '='):
you use:you need:Code:if object=nothing
that's allCode:If objYourObject Is Nothing
Or
[code]
If CBool(ObjPtr(objMyObject))
Returns true iff object is set
:) :) Thanks both of you :) :)