Get C:\ info in the treelistview

Posted on 1998-10-08
Last Modified: 2013-12-26
I followed AllanC_Jr's advice to run a "VB Application Wizard" and choose Explorer Style and it worked. Now I want to know what to write so the information on the harddrive appear in the "TreelistView" Then I want to link the "treelistView" with the "ListView" what are the codes?

Description: I want to be able to doubleclick on the driver C: in the "Treelistview" (the directories appears), when I doubleclick on one directory the contents appears in the "ListView"

If you can solve this for my, please do. It will mean a lot to me.
Question by:ChristianJ
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1487496
Private Sub Tree_Click()
   call fsb_GetTree(Tree.SelectedItem)
End Sub

Private Sub fsb_GetTree(as_Path As String)
Dim ls_DirName As String
On Error Resume Next
ListView1.Arrange = lvwAutoLeft
ls_DirName = Dir(as_Path, vbDirectory)
Do While ls_DirName <> ""
   If ls_DirName <> "." And ls_DirName <> ".." Then
      If (GetAttr(as_Path & ls_DirName) And vbDirectory) = vbDirectory Then
         ListView1.ListItems.Add Text:=ls_DirName
      End If
   End If
   ls_DirName = Dir

End Sub

Author Comment

ID: 1487497
It didn't work
Do you have some thing else that might help?
LVL 13

Expert Comment

ID: 1487498
Take a look at the EnumDesk sample which is located at the Microsoft Owner site. This does what you want.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 13

Expert Comment

ID: 1487499
Take a look at the EnumDesk sample which is located at the Microsoft Owner site. This does what you want.

Author Comment

ID: 1487500
it didn't work can I try something else?

Accepted Solution

JiaH earned 40 total points
ID: 1487501
How about this one:
Keep the Node.FullPath to a variable in the TreeView's NodeClick event, in the TreeView's DblClick event, use this variable  and the Dir to get all the contents under the directory , then what you need is add them to the listview.

Good luck!

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month3 days, 19 hours left to enroll

630 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