• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2364
  • Last Modified:

Using Treeview and listview control(VB 6.0)

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
1 Solution
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.

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

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
      Case "OverviewGuests"
      Case "OverviewRooms"
     End Select
End Sub


Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now