Link to home
Start Free TrialLog in
Avatar of BobSamonik
BobSamonik

asked on

Assigning null to an Object

How to assign NULL value to an Object?
Avatar of ghimireniraj
ghimireniraj

Set MyObject = Nothing

Is it?


--Niraj


Avatar of BobSamonik

ASKER

I can't test it on Nothing and if I assign Nothing
IsNull(MyObject) returns false
I can't test it on Nothing and if I assign Nothing
IsNull(MyObject) returns false
From MSDN:

IsNull Function Example
This example uses the IsNull function to determine if a variable contains a Null.

Dim MyVar, MyCheck
MyCheck = IsNull(MyVar)   ' Returns False.

MyVar = ""
MyCheck = IsNull(MyVar)   ' Returns False.

MyVar = Null
MyCheck = IsNull(MyVar)   ' Returns True.




--Niraj
ASKER CERTIFIED SOLUTION
Avatar of svd2002
svd2002

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
MyCheck has to be declared as an Object becouse I use its methods later
And if a declare it as an object I can't assign Null to it or i don't know how.
hey
that could help
just a sec svd2002
thats what I needed svd2002
I tried with IsNothing but there is no function like that , then I treid
if MyObject=Nothing ... but that did not work eather
thanks everybody
thats what I needed svd2002
I tried with IsNothing but there is no function like that , then I treid
if MyObject=Nothing ... but that did not work eather
thanks everybody