• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

Assigning null to an Object

How to assign NULL value to an Object?
0
BobSamonik
Asked:
BobSamonik
  • 6
  • 2
1 Solution
 
ghimirenirajCommented:
Set MyObject = Nothing

Is it?


--Niraj


0
 
BobSamonikAuthor Commented:
I can't test it on Nothing and if I assign Nothing
IsNull(MyObject) returns false
0
 
BobSamonikAuthor Commented:
I can't test it on Nothing and if I assign Nothing
IsNull(MyObject) returns false
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ghimirenirajCommented:
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
0
 
svd2002Commented:
As said by ghimireniraj, you can set
Set MyObject = Nothing

And then check
If MyObject Is Nothing Then
  ' Code
End If

You said that you can't test it on "Nothing". Why?
0
 
BobSamonikAuthor Commented:
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.
0
 
BobSamonikAuthor Commented:
hey
that could help
just a sec svd2002
0
 
BobSamonikAuthor Commented:
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
0
 
BobSamonikAuthor Commented:
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
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now