|
-
Jul 13th, 2001, 12:59 PM
#1
Thread Starter
Member
A Flustering Question
I have been researching this on the internet for about 3 months and I have had no luck. So I decided to post this message to see if any of you know how to do this >>>>
I want to give a directory name to my application and have it scan that directory for MP3, WMA and M3U files. I have downloaded many sample applications but unfortunitly its a b*** sometimes to retrofit codes into your own application...Can any of you tell me how to read files into a list box using a given file extention & directory??? Thank you! ([email protected])
-
Jul 13th, 2001, 01:45 PM
#2
Member
There's an article on VB world about this. And I feel your pain, file searching code is rough.
-
Jul 13th, 2001, 02:21 PM
#3
Black Cat
It's not that hard, just modify this:
VB Code:
Private Sub Command1_Click()
Dim strFileName As String 'the file name
Dim strFolder As String 'the dir to search
Dim strExt As String 'the file extension
'test
strFolder = "C:\Winnt"
'add the trailing slash if it's not their
If Right(strFolder, 1) <> "\" Then strFolder = strFolder & "\"
strFileName = Dir(strFolder)
While strFileName <> ""
strExt = LCase(Right(strFileName, 4))
If (strExt = ".jpg") Or (strExt = ".bmp") Then
List1.AddItem strFolder & strFileName
End If
strFileName = Dir
Wend
End Sub
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|