Click here to Skip to main content
15,867,568 members
Articles / Programming Languages / C#
Article

Implementing a common File system browser with a ListView

Rate me:
Please Sign up or sign in to vote.
4.10/5 (22 votes)
24 Sep 2003 217K   4.7K   62   44
A ListView Control like the one used in Windows Explorer

Sample Image - FileSystemListView.jpg

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.

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


Written By
Architect CGI
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Generalvisual studio .net 2005 beta Pin
Anonymous11-Sep-04 16:16
Anonymous11-Sep-04 16:16 
GeneralRe: visual studio .net 2005 beta Pin
WilsonProgramming8-Nov-04 13:41
WilsonProgramming8-Nov-04 13:41 
GeneralRe: visual studio .net 2005 beta Pin
WilsonProgramming9-Nov-04 10:43
WilsonProgramming9-Nov-04 10:43 
GeneralRe: visual studio .net 2005 beta Pin
Andreas Hollmann13-Feb-06 11:30
Andreas Hollmann13-Feb-06 11:30 
GeneralRe: visual studio .net 2005 beta Pin
lcalabrese12-Dec-08 1:24
lcalabrese12-Dec-08 1:24 
Generalimplementing Pin
nicbiondi3-Aug-04 7:14
nicbiondi3-Aug-04 7:14 
GeneralRe: implementing Pin
hollandridderkerk15-Aug-04 21:00
hollandridderkerk15-Aug-04 21:00 
GeneralRe: implementing Pin
nicbiondi16-Aug-04 6:31
nicbiondi16-Aug-04 6:31 
awesome, thanx.
GeneralBase Folder Pin
hollandridderkerk5-Jul-04 4:57
hollandridderkerk5-Jul-04 4:57 
GeneralRe: Base Folder Pin
Chris Hambleton18-Aug-04 7:47
Chris Hambleton18-Aug-04 7:47 
GeneralUsing the mouse to select items. Pin
mpalle5-May-04 10:01
mpalle5-May-04 10:01 
GeneralError message Pin
bunkscene3-Jan-04 15:34
bunkscene3-Jan-04 15:34 
GeneralRe: Error message Pin
Jonathan Gauthier4-Jan-04 3:04
Jonathan Gauthier4-Jan-04 3:04 
GeneralRe: Error message Pin
Le_MuLoT8-Apr-05 5:45
Le_MuLoT8-Apr-05 5:45 
QuestionCan this be used in a Console App? How? Pin
Anonymous19-Dec-03 7:32
Anonymous19-Dec-03 7:32 
AnswerRe: Can this be used in a Console App? How? Pin
Jonathan Gauthier4-Jan-04 3:05
Jonathan Gauthier4-Jan-04 3:05 
GeneralSorting Pin
ryanul12-Dec-03 11:31
ryanul12-Dec-03 11:31 
QuestionNo Draging? Pin
WebMaster13-Nov-03 12:14
WebMaster13-Nov-03 12:14 
AnswerRe: No Draging? Pin
Jonathan Gauthier4-Jan-04 3:07
Jonathan Gauthier4-Jan-04 3:07 
GeneralGreat Control Pin
zorbal23-Oct-03 22:11
zorbal23-Oct-03 22:11 
GeneralRe: Great Control Pin
Jonathan Gauthier24-Oct-03 16:09
Jonathan Gauthier24-Oct-03 16:09 

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.