Click here to Skip to main content
12,823,625 members (52,574 online)
Click here to Skip to main content
Add your own
alternative version


19 bookmarked
Posted 22 May 2003

FilesystemTree control in .NET

, 22 May 2003
Rate this:
Please Sign up or sign in to vote.
A FilesystemTree view control in VB.NET. Developed with VS.NET, using the 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 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).

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.




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


About the Author

Harish loves computers for their basic quality of running tasks given and doing things clockwork without day-dreaming like him.

Note: My employer does not subscribe to my thoughts posted in my articles.

You may also be interested in...


Comments and Discussions

GeneralUpload MS Access Data on Network Pin
Sanjay C H19-Jun-06 4:08
memberSanjay C H19-Jun-06 4:08 
Generaltree duplicates file/directory names Pin
bc6018-Apr-06 9:05
memberbc6018-Apr-06 9:05 
GeneralXP Icons Pin
öalkfjöaldkfjaödlfkj???7-Feb-05 2:33
sussöalkfjöaldkfjaödlfkj???7-Feb-05 2:33 
GeneralVB .NET 1.1 - Out Of Memory Exception Pin
branded218-Mar-04 5:35
memberbranded218-Mar-04 5:35 
GeneralRe: VB .NET 1.1 - Out Of Memory Exception Pin
Harish Palaniappan24-Mar-04 6:05
memberHarish Palaniappan24-Mar-04 6:05 
GeneralFileSystemTree Control Additions Pin
csnyder3-Nov-03 14:34
membercsnyder3-Nov-03 14:34 
I find that I need a little more functinality in the control

So, I addes a property and an event.

The property is "ShowFiles". If true, then the control will show the files, if false, no files are shown, just directories.

I also added an event to fire when the text box changes:

Public Event FileChanged(ByVal sender As Object, ByVal e As System.EventArgs)

Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
RaiseEvent FileChanged(sender, e)
End Sub

So, now I can show the contents of the file when the user selects another file.

The one I want (and don't have yet) is the ability to set a starting directory "P:\Program Files\TrustPrint\Files" and have it already selected and the child nodes expanded.

Any help would be apperciated. Otherwise a great control, and I'm using it in several projects.
GeneralDownload Error Pin
AxelM22-May-03 23:41
memberAxelM22-May-03 23:41 
GeneralRe: Download Error Pin
Harish Palaniappan23-May-03 1:14
memberHarish Palaniappan23-May-03 1:14 
GeneralRe: Download Error Pin
AxelM23-May-03 1:26
memberAxelM23-May-03 1:26 
GeneralRe: Download Error Pin
Anonymous28-May-03 7:46
sussAnonymous28-May-03 7:46 
GeneralRe: Download Error Pin
Anonymous28-May-03 7:50
sussAnonymous28-May-03 7:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170308.1 | Last Updated 23 May 2003
Article Copyright 2003 by Harish Palaniappan
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid