TreeView

lothos12345

Junior Contributor
Joined
May 2, 2002
Messages
294
Location
Texas
I am populating a tree with information from a dataset populated by an XML file.

The xml sheet contains the columns as follows:

MainNumber
DocumentName
Index

Basically when the treeview is loaded the MainNumber would be the parent and the DocumentName would be the children of the parent. My problem is that this can be updated, when the user clicks on a child node information fills 2 textboxes the MainNumber and the DocumentName. The user can make changes and then commit it to the XML. My question is can I load the index value with the DocumentName without user seeing the index. So I can guarantee that I update the correct information since the index is guaranteed to be unique whereas the other 2 aren't. This application is written in Visual Basic.NET. Any help offered is greatly appreciated.
 
If I understand what you are asking, for this to work, you'll need to set the HideSelected property on the treeview to false. That will keep the selected node selected once the treeveiw loses focus. Then in the function you will use to accept the user's changes (probably a button click or something) you'll simply get the SelectedNode from the treeview and set the text to whatever it needs to be set to (and optionally save any XML, though you could do that later if you wanted too). Since it looks like you'll be changing several things at the same time, you can get the parents, children, or siblings of that node and modify or update accordingly. Some more information on TreeNodes.

Does this help at all?
 
Back
Top