🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.language.objectpascal
Article #32409

Re: Display filenames from a folder in a listbox?

#32409
From: Graham Harris
Date: Sun, 24 Nov 2002 21:13
34 lines
1749 bytes
procedure FindFiles(const FileMask: AnsiString; Files: TStrings);
var
   Found: TSearchRec;
begin
   if not Assigned(Files) then
     Exit;

   if FindFirst(FileMask, faAnyFile, Found) = 0 then
   begin
     try
       Files.Add(Found.Name);

       while FindNext(Found) = 0 do
          Files.Add(Found.Name);
     finally
       FindClose(Found);
     end;
   end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
   FindFiles('C:\*.abc', ListBox1.Items);
end;

HTH

Graham Harris

Mike Sorum wrote:
> How can I display in a listbox the file names of all, for example, *.abc
> files that are in a folder?
> 
> 
Technical Details
Message-ID: <3DE140F5.8050706@bmsgharr.globalnet.co.uk>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!news.uni-x.net!newsgroups.borland.com!not-for-mail
References: <3de12a4a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109d30,9c28aca45e90a5ef
X-Google-Attributes: gid109d30,public
X-Google-ArrivalTime: 2002-11-24 13:15:30 PST
Message-ID: <3DE140F5.8050706@bmsgharr.globalnet.co.uk>
Date: Sun, 24 Nov 2002 21:13:25 +0000
From: Graham Harris <ng@bmsgharr.globalnet.co.uk>
Reply-To:  ng@bmsgharr.globalnet.co.uk
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.delphi.language.objectpascal
Subject: Re: Display filenames from a folder in a listbox?
References: <3de12a4a$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 81.86.195.20
X-Trace: newsgroups.borland.com 1038172423 81.86.195.20 (24 Nov 2002 13:13:43 -0800)
Lines: 35
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!news.uni-x.net!newsgroups.borland.com!not-for-mail