Solved

Treeview / Listview - Viewing Files in Drives

Posted on 1997-07-09
2
245 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
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…

756 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