?
Solved

Assigning null to an Object

Posted on 2002-06-19
9
Medium Priority
?
171 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

777 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