Page 1 of 1

reading out the path and comparing it with a stored path

Posted: 11 Apr 2007, 14:53
by doubleudee
I have just installed and tried to use your treeview (thanks) and i would like to know how I could do the following:-

1. Move directly to a pre-set directory (which will be a network drive, e.g "h:\savedfiles") and display all the items found in that directory in a listview.

2. If the user selects a different directory I want to be able to display this in a textbox.

so my questions are, how do I compare/set the directory for point 1, and how do I retrieve the directory for point 2.

thanks

Re: reading out the path and comparing it with a stored path

Posted: 12 Apr 2007, 15:02
by TiKu
Hi,
doubleudee wrote:1. Move directly to a pre-set directory (which will be a network drive, e.g "h:\savedfiles") and display all the items found in that directory in a listview.
Just set the Path property to "h:\savedfiles". There's nothing built-in to fill the listview automatically. You'll have to do this yourself using the Dir command of VB6, the FileSystemObject COM library, the FindFirstFile()-Win32-API function, the shell interfaces (IShellFolder and so on) or a similar approach.
doubleudee wrote:2. If the user selects a different directory I want to be able to display this in a textbox.
Use the SelectionChanged event (it may have a slightly different name, I can't look it up right now) and the Path property. Or if you always need a valid filesystem path (the Path property returns another kind of path if it thinks it fits better), you may want to try the ItemHandleToFSPath() method. This method requires the handle of the item for which you want to retrieve the path. The selected item's handle is retrieved through the SelectedItem property.

HTH
TiKu

Posted: 17 Apr 2007, 09:36
by doubleudee
Many thanks