Solved

Treeview / Listview - Viewing Files in Drives

Posted on 1997-07-09
2
257 Views
Last Modified: 2009-07-29
Warrning! i am new to VB and have just started on vb5 (First project).

i want to build a project in which i can browse the desktop, local drives, network drives and others and see all the available files in those drives.  

i have used vb5 wizzard and got the basic code but every where it says 'To Do code...

i also checked out the sample by microsoft for biblo but my problem is file handeling (for this project) not database handeling.  (when time comes i will clearfy the database problem).

who ever answers please give me all the possible code commands with little examples ( i am a quick learner) just give me a jump start.

ps: don't forget to give me examples.  i am willing to raise the points u want me to.
0
Comment
Question by:msali
[X]
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
2 Comments
 
LVL 1

Expert Comment

by:mirkus
ID: 1428162
For see your PC, and your local drive and network you must fill 3 control in your form.
1 Drive control
1 File Control
1 Directory control

Then you must write a code to refresh control for your Choose
In Form_Load event you force Dirve for you c:

           Drive1.Drive="c:\"
           Dir1.Path=Drive1.Drive
           File1.Path =Dir1.Path

Then you must  write code for you click on Control so in

Private Sub Drive1_Change()
    Dir1.Path =Dirve1.Drive
end sub

Private Sub Dir1_Change()
   File1.Path=Dir1.Path
end Sub

File1 , Drive1 , Dir1 is a generic name of your control.

I hope this is what  you'll find

Good luck......            Mirkus

0
 
LVL 9

Accepted Solution

by:
cymbolic earned 50 total points
ID: 1428164
I can't write your useage of Treeview and ListView controls for you, there are too many decisions to make regarding how they look and feel, and what functionality you add to them.  The VB help system, along with examples and a few frustrating weeks should make you reasonably disgusted with them as controls for your app.  But, "Basically",  you have to populate and link their cross useage yourself.  Here's a few hints to get you started.

1) you can use your existing Drive, File and Directory controls to do the lookup work.  Keep them invisible, feed them the right properties, and steal their contents (items) for your own Treeview/Listview controls.

2) You have to refill the ListView on the NodeCLick event of your treeview.  To make it really like Explorer, you also have to go back to the related entry in your TreeView when a directory is opened in your ListView.  You can retain these back & forth pointers in the .tag property of each item in the controls. You have to use only string data in this property, but you can save the respective item keys, and other info as well here.  Use some kind of delimiter (Underline?) to separate individual items.

3) Warning: the .children, .Parent, .Next/First/Last sibling navigation in Treeview can be a real pain for you.

4)generating a unique key for each item is critical on the .AddItem method.  You have to have errorhandling to catch dup keys, you're better off coding ahead to make sure they are unique when you add.

5) Keep in mind that the Treeview control had the most bugs of any control when first released in VB4.0, and don't expect everything to work as advertised (as if anything is that way on any control!:))

6) on the other hand, you get to set each icon on every item in each control, and you can then examine the large or smallicon property to change the behaviour of your app respective to tye of item selected, etc.

7) Let me say that it is not a trivial task, that's why there are alternative methods and other controls provided to achieve the same functionality.    
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month6 days, 11 hours left to enroll

623 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