• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2380
  • 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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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