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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load all .rpt file names from directory to vb listbox?

Status
Not open for further replies.

traceytr

Programmer
Mar 13, 2001
94
US
Hi. I need to create a form that will take all the report files in directory C:\Program Files\AAA\BBB\Report Files and list them out in a VB6 Listbox. They are Crystal Reports and have the .rpt extension. Is there any way I can do this? Thanks in advance.

 
You can use the FileListBox control to list all the files in a folder or use the FileSystemObject to get the folder, loop through each file in it and add the names to the regular listbox by yourself. I recommend FileListBox control.
-Max
 
Code:
Dim FileName As String
FileName = Dir ("C:\Program Files\AAA\BBB\Report Files\*.rpt")
Do Until Len(FileName) = 0
   List1.AddItem FileName
   FileName = Dir()
Loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top