devxlogo

TreeView Control

TreeView Control

Question:
I would like to know how I can add, remove, and see if an item is in the TreeView control. For example:

Prism Pros     4/30/99 7:39AM     4/30/99 8:00AMMcFarley     4/30/99 7:43AM

I want to find out if “Prism Pros” is already in the list.

Answer:
The main problem here is that you need a scheme to uniquely identify each node. If you are tied to a database, the counter or sequence feature (called AutoNumber in Access) can provide a unique number that you know can’t occur twice. If you are working with date and time entries, as shown in your question, you can format the date and time as a long number, such as 990430-0739, and append it to a string containing the parent’s ID. I’ve used this scheme a few times before, and it makes it very easy to determine where in the tree an item is.

See also  How to Avoid Money Transfer Scams  
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist