VB.Net 2005: treeview control

k3n51mm

Active member
Joined
Mar 7, 2007
Messages
40
Programming Experience
3-5
How do I save the state of a treeview control between user sessions? I need to save everything: highlighted nodes, expansions, etc. How?
 
In this forums search box, try entering

iterate treeview

There are some other goods threads about treeviews also. But in .Net
there's alot of iteration with them.

Don't know the best way to save their state, but once iterated it's
possible.
 
Recurse through the directories, and save the entire tree to an XML file.. for example, you could have something like:
VB.NET:
<[COLOR=Black]Node[/COLOR] [COLOR=Red]Name[/COLOR]="[COLOR=RoyalBlue]MyNode[/COLOR]" [COLOR=Red]FullPath[/COLOR]="[COLOR=RoyalBlue]Node1\Node2\MyNode[/COLOR]" [COLOR=Red]Selected[/COLOR]="[COLOR=RoyalBlue]True[/COLOR]" [COLOR=Red]Expanded[/COLOR]="[COLOR=RoyalBlue]False[/COLOR]" />
and so on, for each node in your treeview. Add any properties you need, and rebuild the TreeView based on that XML file when needed.
 
Back
Top