VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Simple Code To List all the Files in a Directory into a List Box

by Raghu (22 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 18th September 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Simple Code To List all the Files in a Directory into a List Box

API Declarations


'Controls : List Box,Command Button
Dim Fs as Scripting.FileSystemObject
Dim Fld as Folder
Dim Fls as Files,Fl as File

'=====================================
'For Suggestion and queries mail to
'[email protected]
'=====================================

Rate Simple Code To List all the Files in a Directory into a List Box



set fs = CreateObject("Scripting.FileSystemObject")
set fld = fs.GetFolder("C:\") ' You can specify any folder name with path here
set fls = fld.getFiles

list1.clear
for each fl in fls
   list1.additem fl.name
next
list1.refresh
End Sub

Download this snippet    Add to My Saved Code

Simple Code To List all the Files in a Directory into a List Box Comments

No comments have been posted about Simple Code To List all the Files in a Directory into a List Box. Why not be the first to post a comment about Simple Code To List all the Files in a Directory into a List Box.

Post your comment

Subject:
Message:
0/1000 characters