Treeview - restore path

DavyEFC

Well-known member
Joined
Dec 17, 2010
Messages
51
Programming Experience
5-10
I have a treeview that acts as a file explorer, i.e. populates with the contents of a drive. I save the last used path in an .ini file and would like to restore this when the program is next run but can't figure out how to get the treeview to go to the stored path.

e.g.

C:\
--Folder1
--Folder2
----SubFolder1
----SubFolder2
------TargetFolder
----SubFolder3
--Folder3

Stored path is C:\Folder2\SubFolder2\TargetFolder - how do i get treeview to go there on app startup (assuming it exists, which i know i've to error trap but that's not my question here)
 
If you put the full path of the folder represented by the node into the node's Name property then you can call Nodes.Find on the TreeView to find the node that represents that path and then expand that path and select it.
 
If you put the full path of the folder represented by the node into the node's Name property then you can call Nodes.Find on the TreeView to find the node that represents that path and then expand that path and select it.

Understood. Thanks for the help...
 
Back
Top