CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2001
    Location
    NC
    Posts
    2

    Hos do I find out if an object exists?

    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.


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Hos do I find out if an object exists?

    You can test it in a If statement

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




    Tom Cannaerts
    [email protected]

    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
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Sep 2001
    Location
    NC
    Posts
    2

    Re: Hos do I find out if an object exists?

    Excellent. Sometimes the obvious is hard to see.

    Sorry about the typo in the title.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured