Results 1 to 4 of 4

Thread: Storing a folder's contents in a listbox

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Location
    Atlanta, GA
    Posts
    177

    Talking

    How do you store the contents of a folder in a list box?

    I.E.>If I wanted to store all files located in the My Documnets folder in a list box.
    212 will lead you to the truth

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Just use a FileListBox, the one next to the yellow DirListBox

    Code:
    File1.Path = "c:\My Documents"
    'This will show all files in C:\My Documents!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3
    Hyperactive Member PITBULLCJR's Avatar
    Join Date
    Nov 1999
    Location
    New York
    Posts
    408
    I am doing this off the top of my head but this should work. What Jop gave you was for a file box but if you want it in a list box what you do is this.

    Add 1 file box make visible false and add 1 listbox.
    Code:
    Option Explicit
    
    Private Sub Form_Load()
    Dim a As Integer
    File1.Path = "c:\My Documents"
    Do Until File1.ListIndex + 1 = File1.ListCount
    File1.ListIndex = a
    List1.AddItem File1.FileName, a
    a = a + 1
    Loop
    End Sub
    That works I went and I tested it. If you only want to add certain files like only Mp3's or something make the file box only show mp3s then the list box will only add mp3s.

    Hope this helps!!


    [Edited by PITBULLCJR on 09-29-2000 at 06:05 PM]
    Sincerely,
    Chris


    Email: [email protected]
    AIM: KnightsOfTheMoon
    WebPage: http://kom.wicre.com
    ----------------
    VB6 Professional
    Abit ST6-RAID
    1000 MHZ
    512 MB PC133 Ram
    Nvidia GeForce 2 Ultra 64 MB
    Maxtor 81.9 Gig
    Win 98 SE

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Location
    Atlanta, GA
    Posts
    177

    Talking

    Thanks guys!
    212 will lead you to the truth

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