Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

FilesystemTree Control in .NET

0.00/5 (No votes)
22 May 2003 1  
A FilesystemTree view control in VB.NET. Developed with VS.NET, using the system.management namespace

The Control

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

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... it's 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).

Using the Code

Add the control to the project. If you 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 the code below, to get the user's selection.

//get the user's selection.
FileSystemTree1.pathselected
//

License

This article has no explicit license attached to it, but may contain usage terms in the article text or the download files themselves. If in doubt, please contact the author via the discussion board below.

A list of licenses authors might use can be found here.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here