Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add list of filenames in Listbox

Status
Not open for further replies.

gundie

Programmer
Feb 5, 2004
69
US
I'm a total Delphi newbie. I need to add the list of filenames from a directory (C:\DATA) into a listbox. How do I do that? Thanks for helping!
 

Easiest way is just use a TFileListBox (filectrl.pas)

 
As Zathras said the easiest way is TFileListBox. You can use it with TDirectoryListBox, TDriveComboBox, and TFilterComboBox
All these components are in 'Win3.1' palette.

I don't know what you want to do. But consider to use (also) OpenDialog, SaveDialog from 'Dialogs' Palette.

Giovanni Caramia

 
Thanks for the replies. What I'm trying to accomplish is to make two listboxes, listbox1 would list all filenames from C:\DATA, and listbox2 would be blank. The user would select filenames from listbox1, click an "add" button, and it would remove the selections from listbox1, and add to listbox2. Also, a "remove" button to do the reverse. Any ideas?
 

I would consider using a hidden TFileListBox and two TListBox components. At start-up (or whenever is appropriate for your application) populate one of the TListBox components from the TFileLsitBox:
Code:
ListBox1.Items.Assign(FileListBox1.Items);
Then carry on with a normal "duelling list boxes" type of process.

 
Thanks for the suggestion, I'll try that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top