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

Files Chooser Dialog

Rate me:
Please Sign up or sign in to vote.
3.25/5 (13 votes)
24 Jan 20052 min read 84.1K   389   40   13
Choose a list of files or folders, and then save or load it.

Files Chooser Dialog

Introduction

It's the very first thing I programmed, so please excuse me if maybe some things aren't done like by a seasoned programmer. This control simply allows to choose a list of files or folders and then save or load it. I commented the code very well, I think you'll understand all my mess quite easily ;-) I spent an extensive time on the GUI and features:

  • Displays the full path or only files names
  • Displays the number of added items
  • You can put a cross on the items you want added in your own program
  • Checks in real time any changes in the files or folders
  • Updates the list of drives and files when a CD-ROM is inserted or removed
  • Drag and drop is supported
  • All the settings are automatically stored in a bin file
  • When you load or save a list, it checks if the files still exist
  • A combobox contains all the recently visited paths
  • You can write a path directly on this combobox
  • You can display messages on this combobox too
  • There's a pin for leaving the form on the top

Please note that only European characters are supported, but I think you can modify it without too much work. I think there aren't any bugs, but I would be very happy to correct any. Enjoy!

Background

  • I retrieve the system icons, thanks to the excellent code from Steve McMahon here.
  • I got my rounded buttons from here, the author is unknown.
  • I got the drive combobox by Odah from here.

Using the code

I included an example that shows how to (easily) retrieve the selected files and the last visited path. The dialog box code is really too long to show here.

History

  • June 11 2004: I corrected a bug, and now it asks you if you want to delete missing files from the list, at startup.
  • January 22 2005: A few bug fixes, and now it works well on systems with drive A:\. The drive A:\ support was simply removed because it slowed down much the whole thing.

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
Web Developer
France France
I'm a stock trader, but sometimes I need to develop some code...

Comments and Discussions

 
GeneralDelete File dialog Pin
anatsg17-Jul-04 3:08
anatsg17-Jul-04 3:08 
GeneralRe: Delete File dialog Pin
Patrick Dorin17-Jul-04 5:45
Patrick Dorin17-Jul-04 5:45 
GeneralRe: Delete File dialog Pin
anatsg17-Jul-04 8:00
anatsg17-Jul-04 8:00 
GeneralRe: Delete File dialog Pin
Patrick Dorin18-Jul-04 7:59
Patrick Dorin18-Jul-04 7:59 
GeneralThis solution does not build in VS.NET 2002 Pin
P VIJAYAKRISHNA16-Jun-04 22:54
P VIJAYAKRISHNA16-Jun-04 22:54 
GeneralRe: This solution does not build in VS.NET 2002 Pin
Patrick Dorin17-Jul-04 5:41
Patrick Dorin17-Jul-04 5:41 
GeneralException when I Add Files Pin
Member 25064315-Jun-04 20:56
Member 25064315-Jun-04 20:56 
GeneralRe: Exception when I Add Files Pin
Patrick Dorin16-Jun-04 6:37
Patrick Dorin16-Jun-04 6:37 
GeneralRe: Exception when I Add Files Pin
ishdaifat13-Jul-04 19:58
ishdaifat13-Jul-04 19:58 
GeneralRe: Exception when I Add Files Pin
Patrick Dorin17-Jul-04 5:40
Patrick Dorin17-Jul-04 5:40 
Question"impressing the girls"? Pin
Uwe Keim8-Jun-04 21:23
sitebuilderUwe Keim8-Jun-04 21:23 
AnswerRe: "impressing the girls"? Pin
Vladimir Ralev9-Jun-04 6:46
Vladimir Ralev9-Jun-04 6:46 
The code is excellent and well documented, what are you talking about?
p.s. Is that a bottle on your pic at work?

Vote for me!
http://www.codeproject.com/netcf/TabletPC.asp
http://www.codeproject.com/netcf/ShakyVoice.asp
GeneralRe: "impressing the girls"? Pin
Anonymous9-Jun-04 8:06
Anonymous9-Jun-04 8:06 

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.