Click to See Complete Forum and Search --> : Hos do I find out if an object exists?


joewilson
September 19th, 2001, 09:10 AM
If an object has not been set, its value is "Nothing" and reference to it will give an error. Is there a way to see if an object exists?

For example, I need to look at the nodes of a TreeView and determine the parent of each node. Node.Parent causes an error if there is no parent.

Cakkie
September 19th, 2001, 09:15 AM
You can test it in a If statement

If myObject is nothing then
Msgbox "Object not set"
End If




Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

joewilson
September 19th, 2001, 09:40 AM
Excellent. Sometimes the obvious is hard to see.

Sorry about the typo in the title.