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.
Technology Partners: 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!

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

710 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