CodeItBetter Programming Another VB Programming Blog

How to use Dir$ function to get filenames and display in a list box or something.

Posted on July 25, 2011
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'File/Folder Handling - How to use Dir$ function to get filenames and display in a list box or something.
strFilename = Dir$(strPath & "*.*", 63)
strfullpath = strPath & strFilename
Do Until Len(strFilename) = 0
    If Not (strFilename = "." Or strFilename = "..") Then
        'Add to list (you decide) with full path recorded somewhere and filename 
        'displayed
        lst.Add strfullpath, strFilename
    End If
 
    'blank file name as otherwise it won't be set to zero length and you'd 
    'endlessly loop
    strFilename = ""
    strFilename = Dir$
Loop
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.