Solved

Assigning null to an Object

Posted on 2002-06-19
9
167 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
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 50 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

827 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