Results 1 to 7 of 7

Thread: How To Load The Names Of All Files In A Folder In A ListBox?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Location
    Rome, Italy
    Posts
    150

    How To Load The Names Of All Files In A Folder In A ListBox?

    How?
    Catholics Do It With Beads

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Try this
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim LoadFiles As String
    3. List1.Clear
    4. LoadFiles = Dir("c:\program files\qcap\*.*")
    5. Do While LoadFiles > ""
    6.    List1.AddItem LoadFiles
    7.    LoadFiles = Dir
    8. Loop
    9. End Sub

  3. #3
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485
    or use da file list box
    me.life = VB

  4. #4
    Hyperactive Member
    Join Date
    Feb 2002
    Location
    Connecticut, USA
    Posts
    308
    What if you didn't want the file names, but just wanted the folder names?

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    A minor amendment to my previous post should do the trick
    VB Code:
    1. Private Sub Command1_Click()
    2. List1.Clear
    3. Dim LoadFiles As String
    4. List1.Clear
    5. LoadFiles = Dir("c:\program files\", vbDirectory)
    6. Do While LoadFiles > ""
    7.    List1.AddItem LoadFiles
    8.    LoadFiles = Dir
    9. Loop
    10. End Sub

  6. #6
    Hyperactive Member DovyWeiss's Avatar
    Join Date
    Feb 2002
    Location
    Miami Beach, FL
    Posts
    366
    then use FolderListBox control and check the Path property

  7. #7
    Hyperactive Member DovyWeiss's Avatar
    Join Date
    Feb 2002
    Location
    Miami Beach, FL
    Posts
    366
    on second thought it's called the DirListBox control... oops

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