Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Assigning null to an Object

Posted on 2002-06-19
9
Medium Priority
?
172 Views
Last Modified: 2010-05-02
How to assign NULL value to an Object?
0
Comment
Question by:BobSamonik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
9 Comments
 
LVL 3

Expert Comment

by:ghimireniraj
ID: 7094830
Set MyObject = Nothing

Is it?


--Niraj


0
 

Author Comment

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

Author Comment

by:BobSamonik
ID: 7094864
I can't test it on Nothing and if I assign Nothing
IsNull(MyObject) returns false
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 3

Expert Comment

by:ghimireniraj
ID: 7094871
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
 
LVL 2

Accepted Solution

by:
svd2002 earned 200 total points
ID: 7094899
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
ID: 7094902
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
ID: 7094904
hey
that could help
just a sec svd2002
0
 

Author Comment

by:BobSamonik
ID: 7094910
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
ID: 7094911
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

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

609 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