Results 1 to 4 of 4

Thread: Using DIR() to show all files in a folder

  1. #1

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720

    Using DIR() to show all files in a folder

    Using DIR() I got all the files that end with .mp3 (for example) show up in a listbox. How would I loop through the listbox now, checking the first letter of each file? And how would I do it with a comboBox?
    asdf

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    something like:
    VB Code:
    1. For ctr = 0 To List1.ListCount
    2.       MsgBox List1.List(ctr)
    3.       If Left(List1.List(ctr),1) = "A" then
    4.               MsgBox ctr
    5.       End if
    6. Next

  3. #3

    Thread Starter
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    Thanks
    asdf

  4. #4
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Originally posted by JordanChris
    something like:
    VB Code:
    1. For ctr = 0 To List1.ListCount
    2.       MsgBox List1.List(ctr)
    3.       If Left(List1.List(ctr),1) = "A" then
    4.               MsgBox ctr
    5.       End if
    6. Next
    I think youll need -1 too, like:
    VB Code:
    1. For ctr = 0 To List1.ListCount  [b]-1[/b]


    And... if your dealing String Data Types, use the $ with the
    relavent function, like: Left$ - Saves the double conversion by VB.

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