Solved

Using Treeview  and listview control(VB 6.0)

Posted on 2004-11-01
2,235 Views
Last Modified: 2010-10-05
Hi there,
  i wanted to create a explorer like thing using treeview and listview control, on the left side of the window will have treeview in which all the folders are displaying and on the right side i have the files on the selection of regarding folders from treeview.


Regards & Thanks
0
Question by:SeanWilliamson
    3 Comments
     
    LVL 5

    Expert Comment

    by:RogueSolutions
    You could use Treeview and Listview but VB6 already has controls for file/directory access.

    They are DirListBox, FileListBox and DriveListBox and are part of the standard toolbar.

    Use these and it will save you a lot of coding.

    0
     
    LVL 27

    Expert Comment

    by:Ark
    0
     
    LVL 1

    Accepted Solution

    by:
    first make sure u have microsoft windows common controls 6.0 ticked in the components dialog

    ------------------Code----------------------
    Private Sub Form_Load()

    With tvwNavigator.Nodes
          .Add , , "Root", "Root node", "Home"                              // Home is the picture name in the imagelist
                                                                                            // if u dont have one give the path of a picture to be displayed
                                                                                            // for the nodes  
          .Add "Root", tvwChild, "AppData", "Appli", "path of pic when node note selected", "path of pic when node note selected"
       
          .Add "AppData", tvwChild, "Guests", "Guests", "ClosedFolder", "OpenFolder"
          .Add "Guests", tvwChild, "GuestForm", "Guests Form", "Form", "Form"
          .Add "Guests", tvwChild, "OverviewGuests", "Overview - Guests", "Table", "Table"
       
          .Add "AppData", tvwChild, "Rooms", "Rooms", "ClosedFolder", "OpenFolder"
          .Add "Rooms", tvwChild, "RoomForm", "Rooms Form", "Form", "Form"
          .Add "Rooms", tvwChild, "OverviewRooms", "Overview - Rooms", "Table", "Table"
       
          .Add "Root", tvwChild, "Reports", "Reports", "ClosedFolder", "OpenFolder"
          .Add "Reports", tvwChild, "CustReport", "Customer Report", "Report", "Report"
       
          .Add "Root", tvwChild, "UserData", "User Data", "ClosedFolder", "OpenFolder"
          If UserLevel = "Full" Then .Add "UserData", tvwChild, "AddUser", "Add New User", "User", "User"

          .Item("Root").Expanded = True
          .Item("AppData").Expanded = True
       End With
    End Sub







    Private Sub tvwNavigator_DblClick()
       Select Case tvwNavigator.SelectedItem.Key
          Case "GuestForm"                 // name of the node
             frmGuest.Show
             frmGuest.SetFocus
          Case "OverviewGuests"
             frmOvwGuest.Show
             frmOvwGuest.SetFocus
          Case "OverviewRooms"
             frmOvwRooms.Show
             frmOvwRooms.SetFocus
         End Select
    End Sub

    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    884 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now