Title: FilesystemTree control in .net Author: Harish palaniappan Environment: VB.net, developed with vs.net Keywords: .net Control, filesystem, folderview, folderlist Level: Intermediate Description: A filesystempTree view control in vb.net.. developed with vs.net, using the system.management namespace
FilesystemTree is a control which will read the system resources and display
a tree from which a user can navigate to a file or a folder...
Programmers can use this control as part of their applications to allow users to
navigate to a folderList or fileSystemTree structure, and get back the
file/folder path that the user has selected.
The code is self-explanatory.
Briefly, it has a treeview control linked to an imagelist control.
the imagelist control is for the treeview to pick its icons from.
To view the images in the imagelist control, open properties of the imagelist control
and click on the ellipsis (...) next to the images property.
using system.management namespace in .net, the treeview is filled with the resources/drives available
on the system
and as the user expands a node. sub-nodes are populated in a more user-friendly way.
the textbox above the treeview control is populated with the user's selection of a file/folder.
The textbox is disabled... its only for viewing.
The user's selection can also be accessed by using "filesystemtree1.pathselected" (if filesystemtree1 is an instance of the control on an application)
add the control to the project. if u are using vs.net, right click on the toolbox in vs.net -> customize -> browse to the control's dll and select. this will get the control on the toolbox. drag and drop the control on to your application. if the control's instance on your application is called 'FilesystemTree1', use code below, to get the user's selection.
'get the user's selection. FileSystemTree1.pathselected '