Board index » delphi » Listing files in a combobox

Listing files in a combobox

I want to scan a directory for files with the extension .PEN and than list
them in a combobox.

How?

Regards,
Ben van Erp

 

Re:Listing files in a combobox


I have a tip on loading an entire directory into a TListBox at
http://members.truepath.com/delphi

--
--
Lewis Howell
lewishow...@yahoo.com
Lou's Delphi Tip of the Day:
http://members.truepath.com/delphi
Lou's personal webpage:
http://members.truepath.com/LewisHowell

Quote
D-99 wrote in message <7fipjc$j2...@news.worldonline.nl>...
>I want to scan a directory for files with the extension .PEN and than list
>them in a combobox.

>How?

>Regards,
>Ben van Erp

Re:Listing files in a combobox


Simple way of doing this:

var Sr: TSearchRec;
       R: Integer;

begin
     ComboBox1.Items.Clear;
     I := FindFirst('*.PEN', faAnyFile, SR)
    While I = 0 do begin
        ComboBox1.Items.Add(SR.Name);
        I := FindNext(SR);
    End;
    FindClose(SR);
end;

I think you need SysUtils in your uses clause.  Can't remember for sure ;)

Good luck!

Stuart.

Quote
D-99 <bv...@usa.net> wrote in message

news:7fipjc$j21$1@news.worldonline.nl...
Quote
> I want to scan a directory for files with the extension .PEN and than list
> them in a combobox.

> How?

> Regards,
> Ben van Erp

Other Threads