1. FolderBrowserDialog Unmasked: Everything You Wanted To Know About The
Folder Browser Component From .Net Framework
Introduction
The FolderBrowserDialog, available as part of the .Net framework, provides a folder browser component for your
C# and VB.Net applications. The UI consists of a modal dialog which contains a tree control displaying all the files
and folders on the system. The user can then browse and select a folder from the tree. The full path of the selected
folder is then returned.
Basic Usage
To display a folder explorer UI to the user, a FolderBrowserDialog instance is created and the ShowDialog method
is called. This shows the modal dialog containing the folder browser control (tree) and an OK and Cancel button. If
the user selects a folder and clicks the OK button, the ShowDialog method returns DialogResult.OK and the
SelectedPath property contains the full path of the selected folder. If the user clicks the Cancel button, the
ShowDialog method returns DialogResult.Cancel.
Advanced Usage
The RootFolder property can be set to the full path of the folder which is to be displayed as the root of the tree
control of the folder browser component. For example, if this property is set to
Environment.SpecialFolder.Personal, only folders from the 'My Documents' are displayed in the tree, so the user
can only select 'My Documents' or its sub-folders.
Prior to displaying the folder browser control, the SelectedPath property can be set to the full path of a folder
causing that folder to be pre-selected in the folder browser tree. For example, when this property is set to "c:",
the node corresponding to the c: drive is pre-selected in the tree when the dialog is first displayed.
If the ShowNewFolderButton property is set to true, then, in addition to the folder browser tree control, and the OK
and Cancel buttons, the folder browser dialog also displays an additional 'New Folder' button which when clicked,
creates a new folder under the currently selected folder.
2. FolderBrowserDialog Included in FolderBrowserDialog Included in FolderBrowserDialog Included in
FolderView Control Showing Files FolderView Control Showing Multi- FolderView Control Showing
As Well As Folders. State Check Boxes Multiple Root Nodes.
FolderBrowserDialog Included in
FolderBrowserDialog Included in FolderBrowserDialog Included in
FolderView Control With
FolderView Control Showing Custom FolderView Control Showing
Appearance Completely
Context Menu Items. Custom/Virtual Items (Non-
Changed.
Files/Folders)
More Screenshots
Limitations
While the folder browser component is a handy way to allow the users to browse and select folders, it suffers from
many limitations, some of them preventing the component from being of practical use in applications.
Modal Functionality
The most visible drawback of the folder browser component is that it displays its UI in the form of a modal dialog.
When shown, it blocks the rest of the application until the user has chosen a folder. As long as the dialog is
displayed, no input (keyboard or mouse click) can occur except within the dialog box. The user must click the OK
or Cancel button before input to the calling program can occur.
This is a very annoying and limiting feature of the FolderBrowserDialog. Users are very likely to be irritated and
annoyed when they have to interact with a modal dialog every time they have to explore and select a folder. A
non-modal UI control which can be put inside of one of the applications's own forms or dialogs is a much more
user-friendly way of displaying the same UI.
No Virtual (Non-file system) folders
The FolderBrowserDialog does not allow the user to select virtual (Non-file system) folders such as the Control
Panel or My Computer. It only allows the user to select a file system path such as "c:" or "c:windows".
No Files
3. The component does not allow the user to select files. This is a major drawback since there are many
circumstances where the user may need to select a file while still using the tree UI to browse to that file.
Limited Choice of RootFolder
The root folder of the folder browser control can be only set to one of the 'special folders' defined by Windows such
as the 'My Documents' or 'My Computer'. This is a major limitation since this means you cannot set the root folder
to a path such as the "d:" drive.
No Multiple Selection
The folder browser component does not allow multiple folders to be selected.
No Check Boxes
The folder explorer tree in the FolderBrowserDialog cannot show check boxes next to nodes. Ability to show multi-
state check boxes can be a very handle feature for such a control.
No Filtering
The FolderBrowserDialog has no support for filtering. For example, it is not possible to display only network folders
or only shared folders or only folders starting with the string "Documents" or files having a particular extension.
No Custom Controls
When using the FolderBrowserDialog, you are only limited to the actual folder explorer tree control, the OK, Cancel
and New Folder buttons and the description label. It is not possible to add custom controls to the dialog box. This
can be useful in many circumstances such as when you want to show a thumbnail/preview of the selected
file/folder or any kind of additional information.
No Appearance Control
The appearance of the FolderBrowserDialog and its constituent controls cannot be changed. Neither can attributes
of individual folders show in the folder explorer control be changed. For example, it is not possible to change the
background color of the tree control or to set the font and color of individual nodes/folders in the tree.
No Custom items
The FolderBrowserDialog cannot display external/custom items in the folder explorer tree. For example, it may be
necessary to display items from an FTP location in addition to the file system items. This is not possible with the
FolderBrowserDialog.
No Lockdown
The FolderBrowserDialog allows unhindered operations on folders. The user can rename folders, do drag-drop
operations and display the context menu and invoke various operations. In many cases, it may be necessary to
limit or altogether prevent such potentially dangerous and irreversible operations, however the
FolderBrowserDialog provides no way of doing that.
Beyond The FolderBrowserDialog : The FolderView Control
The FolderView Control brings a Windows Explorer like folder browser component to your applications complete
with AutoUpdate, dragdrop, icons, contextmenus, Non-file system items, default key-handling, infotips and
renaming. It features powerful behavior control and customization functionality that takes it miles ahead of
Windows Explorer by adding features like filtering, checkboxes, custom items, multiple root nodes, dragdrop
control and customization of default contextmenus, displaynames, icons and infotips.
4. The FolderView control is a UI control which can be dropped right inside your own forms and dialogs. A non-modal
file & folder browsing/selection experience right inside your own dialogs and forms is something that users will
appreciate and find intuitive and simple.
Additionally, FolderView overcomes all the limitations of the FolderBrowserDialog and provides far greater and
advanced features and functionality than the FolderBrowserDialog. The following table is a quick comparison of the
FolderView Control with the FolderBrowserDialog.
FolderView Control FolderBrowserDialog
Modal UI. The component
Drop-In Windows Explorer like folder browser
Yes cannot be dropped in your
functionality.
own form.
Complete Windows Explorer functionality include
a file/folder browsing listview (similar to
Windows Explorer's right-side) and a drive Yes. As part of Shell MegaPack No
selection control (similar to Windows Explorer's
address bar)
Ability to select virtual (Non-file system) folders Yes No
Ability to specify any and all folders as root. Yes No
Ability to show files as well as folders. Yes No
Multi-state check boxes Yes No
Filtering capabilities Yes No
Custom controls Yes No
Colors and appearance of the
Appearance Control control as a whole and of individual No.
folders/files can be changed.
Custom Items Yes No
Yes. For all folders or on a per-
Prevent renaming, drag-drop, context menus No
folder basis.
Multiple root folders Yes No
Change default display names, icons, overlay
Yes No
icons, infotip, etc
Simply and easy to use API Yes Clumsy, inflexible API
Access complete information of a file/folder
including its displayname, fullpath, checkstate,
selection state and attributes like whether it is a Yes No
shortcut, shared, hidden, readonly, file and
folder.
Prevent display of contextmenus for all folders
using a simple property or on a per-folder basis Yes No
using an event.
Prevent dragdrop for all folders using a simple
Yes No
property or on a per-folder basis using an event.
Allow/disallow renaming for all folders using a
simple property or on a per-folder basis using an Yes No
event.
5. Allow/disallow selection for all folders using a
simple property or on a per-folder basis using an Yes No
event.
Allow/disallow expanding/collapsing on a per-
Yes No
folder basis using an event.
Change default drag actions during dragdrop
Yes No
(e.g. from Copy To Move)
Control checking/unchecking on a per-folder
Yes No
basis.
Prevent execution of default shell commands
( e.g. Open, Cut, Properties, etc. in response to
keystrokes or through the context menu) for all Yes No
folders using a simple property or on a per-folder
basis using an event.
Show/hide hidden folders using a simple
Yes No
property.
Show/hide virtual folders ( e.g. Control Panel )
Yes No
using a simple property.
Enumerate all folders shown in FolderView. Yes No
Enumerate all folders according to folder
Yes No
hierarchy structure.
Execute shell commands ( e.g. Cut, Delete, etc )
Yes No
on folders.
Associate developer defined data with each folder Yes No