Results 1 to 3 of 3

Thread: A Flustering Question

  1. #1

    Thread Starter
    Member davethebrat's Avatar
    Join Date
    Jul 2001
    Location
    Buffalo, NY
    Posts
    51

    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])

  2. #2
    There's an article on VB world about this. And I feel your pain, file searching code is rough.

  3. #3
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    It's not that hard, just modify this:
    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim strFileName As String 'the file name
    3.     Dim strFolder As String 'the dir to search
    4.     Dim strExt As String 'the file extension
    5.    
    6.     'test
    7.     strFolder = "C:\Winnt"
    8.  
    9.     'add the trailing slash if it's not their
    10.     If Right(strFolder, 1) <> "\" Then strFolder = strFolder & "\"
    11.         strFileName = Dir(strFolder)
    12.         While strFileName <> ""
    13.             strExt = LCase(Right(strFileName, 4))
    14.             If (strExt = ".jpg") Or (strExt = ".bmp") Then
    15.                 List1.AddItem strFolder & strFileName
    16.             End If
    17.             strFileName = Dir
    18.         Wend
    19. 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
  •  



Click Here to Expand Forum to Full Width