Click here to Skip to main content
15,867,141 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

 
GeneralMy vote of 5 Pin
Cpei1-Mar-11 19:06
Cpei1-Mar-11 19:06 
GeneralAdd-in Code to select a default custom Folder on opening Pin
kabamaru13-Dec-10 9:35
kabamaru13-Dec-10 9:35 
QuestionDoesn't seem to work on VS 2005, have any idea why? Pin
trogov11-Dec-07 20:46
trogov11-Dec-07 20:46 
AnswerRe: Doesn't seem to work on VS 2005, have any idea why? Pin
trogov17-Dec-07 5:30
trogov17-Dec-07 5:30 
QuestionUpgrading To .Net 2.0 Pin
AndreGr12-Nov-06 23:45
AndreGr12-Nov-06 23:45 
AnswerRe: Upgrading To .Net 2.0 Pin
AndreGr14-Nov-06 2:34
AndreGr14-Nov-06 2:34 
Questionhow to get selected filename Pin
cskurdal1-Sep-06 7:25
cskurdal1-Sep-06 7:25 
GeneralWhy you didn't post the whole project ?! Pin
mark_md427-Jul-06 22:55
mark_md427-Jul-06 22:55 
GeneralRe: Why you didn't post the whole project ?! Pin
Jonathan Gauthier29-Jul-06 23:49
Jonathan Gauthier29-Jul-06 23:49 
QuestionHidden Folders? Pin
Daniel Schaffer23-Jan-06 4:29
Daniel Schaffer23-Jan-06 4:29 
AnswerRe: Hidden Folders? Pin
Jos Branders31-Oct-09 6:52
Jos Branders31-Oct-09 6:52 
GeneralAdd sorting capability Pin
DemonFox5-Sep-05 0:28
DemonFox5-Sep-05 0:28 
GeneralRe: Add sorting capability Pin
Mark Johnson24-Aug-07 20:00
Mark Johnson24-Aug-07 20:00 
GeneralProblem finding bug.. Pin
dermoultam16-Aug-05 19:55
dermoultam16-Aug-05 19:55 
Generaladd context (right-click) menu with delete file, rename file, create directory, delete directory Pin
joejoeyeahbaby30-Jun-05 17:20
joejoeyeahbaby30-Jun-05 17:20 
GeneralAdd . (currentfolder) to control and also add missing files Pin
joejoeyeahbaby30-Jun-05 17:05
joejoeyeahbaby30-Jun-05 17:05 
GeneralRe: Add . (currentfolder) to control and also add missing files Pin
joejoeyeahbaby2-Jul-05 13:17
joejoeyeahbaby2-Jul-05 13:17 
GeneralException during browsing of "My Network Places" Pin
om31-May-05 22:26
om31-May-05 22:26 
GeneralHELP - Don't show ZIP and PDF files ! Pin
Le_MuLoT8-Apr-05 6:43
Le_MuLoT8-Apr-05 6:43 
GeneralRe: HELP - Don't show ZIP and PDF files ! Pin
Le_MuLoT15-Sep-05 10:38
Le_MuLoT15-Sep-05 10:38 
GeneralExecuting Selected Files Pin
Le_MuLoT8-Apr-05 3:36
Le_MuLoT8-Apr-05 3:36 
GeneralAny one implemented this in vb.net Pin
vanjari22-Sep-04 3:26
vanjari22-Sep-04 3:26 
GeneralRe: Any one implemented this in vb.net Pin
eelisMX23-Sep-04 4:40
eelisMX23-Sep-04 4:40 
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 

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.