Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

Treeview / Listview - Viewing Files in Drives

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
msali
Asked:
msali
1 Solution
 
mirkusCommented:
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
 
cymbolicCommented:
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: 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