Results 1 to 7 of 7

Thread: (Resolved) Problem getting folders and subfolders to appear in treeview....

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Posts
    137

    (Resolved) Problem getting folders and subfolders to appear in treeview....

    Hello,

    I am trying to create a costom windows explorer with treeview. I can get the drives but I have problems getting all the folders and subfolders. Help please.

    vbBoy
    Last edited by vbBoy; Sep 26th, 2001 at 11:36 AM.

  2. #2
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    How come? What's the problem?
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  3. #3
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Something to begin

    There's surely a better way, this is too slow:

    Code:
    Option Explicit
    
    Private Sub Form_Load()
        Dirs.Path = "C:\"
        TV.Nodes.Add , , "C:\", "C:\"
        AllDirs 0
    End Sub
    
    Private Sub AllDirs(Indice As Integer)
        If Dirs.ListCount Then
            If Dirs.List(Indice) = "" Then Exit Sub
            TV.Nodes.Add Dirs.Path, tvwChild, Dirs.List(Indice), _
              Mid$(Dirs.List(Indice), RInstr(Dirs.List(Indice), "\") + 1)
            Dirs.Path = Dirs.List(Indice)
            AllDirs 0
            Dirs.Path = Left$(Dirs.Path, RInstr(Dirs.Path, "\") - 1)
            AllDirs Indice + 1
        End If
    
    End Sub
    
    Private Function RInstr(AllString As String, ToFind As String)
        Dim i As Integer
        
        For i = Len(AllString) To 1 Step -1
            If Mid$(AllString, i, Len(ToFind)) = ToFind Then Exit For
        Next i
        RInstr = i
    End Function
    Dirs is a DirListBox and TV is a TreeView. But as I said... it's way too slow
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  4. #4
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774
    There is a pretty decent tutorial here on using FSO to populate a Treeview with drives and folders/sub-folders.

    http://abstractvb.com/learn.asp?CID=85

    Not the fastest way and I'm positive FuzzyBurt will have a comment about using FSO but....


  5. #5
    Frenzied Member
    Join Date
    Aug 2001
    Posts
    1,075
    Here is a sample I wrote the first week I got my hands on VB4/32 (note the crappy icons) I commented it pretty good because I posted it on a lot of sites back then. I works good but please don't comment on my code it was a long time ago. In fact, I'm amazed I still have it.

    It uses the win32 API and not FSO

    Greg
    Free VB Add-In - The Reference Librarian
    Click Here for screen shot and download link.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Posts
    137

    Thanxs Guys

    It has helped me a lot.

    vbBoy.

  7. #7
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166
    How did you change the title of your post to include (Resolved)

    Nice idea

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