Thread: uniquely identifying TreeNodes

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    731

    uniquely identifying TreeNodes

    I need to be able to identify a TreeNode in a TreeView uniquely so that I can get the TreeNode only by knowing the unique value. I tried to use the TreeNode.Index property but that is only unique to the TreeNode list that it is in (it doesn't take into consideration parent nodes, etc). Does anyone have an idea on how I can do this?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Set the Tag-attribute to something unique, like an integer that is constantly increased for each node, possibly reusing old indexes if nodes are removed? Perhaps use the "pointer" value of the node itself (dunno how accurate this is)?
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    ahh ok didn't think of the tag idea there. I am currently using the HWND and it appears to work. Only thing that I can so go wrong there is if anouther peice of code removes the treenode, like unmanaged code. I doubt that'll happen though, and if it does I didn't do it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Identifying Triangles
    By howeezy in forum C++ Programming
    Replies: 5
    Last Post: 10-08-2005, 12:14 PM
  2. Identifying Who Logged In & getlogin()
    By Crashgr in forum Linux Programming
    Replies: 12
    Last Post: 12-25-2004, 09:01 PM
  3. identifying string input
    By winsonlee in forum C Programming
    Replies: 1
    Last Post: 05-06-2004, 08:18 AM
  4. Identifying string input
    By winsonlee in forum C Programming
    Replies: 1
    Last Post: 04-23-2004, 09:02 AM
  5. Identifying size of structure arrays
    By gowtham in forum C Programming
    Replies: 2
    Last Post: 02-10-2003, 05:02 PM