Visual Studio .NET 2003Windows 2003.NET 1.1Windows 2000Windows XPIntermediateDevVisual StudioWindows.NETC#
Implementing a common File system browser with a ListView






4.10/5 (18 votes)
Sep 25, 2003

222321

4762
A ListView Control like the one used in Windows Explorer
- Download source files - 89.3 Kb (Demo included)
Introduction
Very often, we need to have a control for browsing the user file-system in order to select files or folders in our applications. But Microsoft did not include a control like that with Visual Studio .NET, so I gave it a try and developed a ListView component very similar to the one used in Windows Explorer.
Exceptions
- Please note that Shell operations are not implemented and are not planned.
- The "My Documents" icon is not the good one.
Key Features
- Use the System ImageList for retrieving the icons (pretty fast)
- Allows to get back to the parent folder (..), so you don't need a companion control or other button for doing that. (
AllowParentFolderSelection
property)
Usage
Just drag the component onto your form and call the control's Initialize()
method in the form Load event.
Conclusions
So this is it. Maybe it will give you a good start for a more complete version.
Credits
- Thanks to Furty for his works with his
TreeView
control. It gave me ideas for mine and I used the Shell32 stuff he discovered in coding his control. SystemListView
code developed and borrowed from Steve McMahon. Click here for his article.