Setting object to Nothing

V

Ven

If an Object is holding a valid reference to an Object, should I set it to
Nothing before I set it to a another Object of the same type?

ex:
Dim objNode
Set objNode=Node1 ' Say node1 is some expression
' Do some processing and then. Should I set it to Nothing?

Set objNode=Node2 ' Say node1 is some expression

Is it the same in ASP and VB

Thank You
 
A

AnthonyWJones

Hmm... Thats a lot of info to take in.

Simply the answer is no you don't need to assign nothing before assigning
another object reference to an existing one.

Nothing is not a magic word that causes VB to do drastically different things.

Basically what VB does when you use the SET assignment (Set objA = objB) is
this:-

Test objA for non-null value.
If non-null value found treat it as a pointer to an object and call the
objects release method
copy value of objB to objA
Test objA for non-null value
If non-null value found treat it as a pointer to an object and call the
objects AddRef method.

That's it.

Nothing is simply a Constant null object pointer.

Anthony.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top