65.9K
CodeProject is changing. Read more.
Home

Files Chooser Dialog

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.25/5 (13 votes)

Jun 9, 2004

2 min read

viewsIcon

84636

downloadIcon

391

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.