Solved

Assigning null to an Object

Posted on 2002-06-19
9
165 Views
Last Modified: 2010-05-02
How to assign NULL value to an Object?
0
Comment
Question by:BobSamonik
  • 6
  • 2
9 Comments
 
LVL 3

Expert Comment

by:ghimireniraj
Comment Utility
Set MyObject = Nothing

Is it?


--Niraj


0
 

Author Comment

by:BobSamonik
Comment Utility
I can't test it on Nothing and if I assign Nothing
IsNull(MyObject) returns false
0
 

Author Comment

by:BobSamonik
Comment Utility
I can't test it on Nothing and if I assign Nothing
IsNull(MyObject) returns false
0
 
LVL 3

Expert Comment

by:ghimireniraj
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 2

Accepted Solution

by:
svd2002 earned 50 total points
Comment Utility
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
 

Author Comment

by:BobSamonik
Comment Utility
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
 

Author Comment

by:BobSamonik
Comment Utility
hey
that could help
just a sec svd2002
0
 

Author Comment

by:BobSamonik
Comment Utility
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
 

Author Comment

by:BobSamonik
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now