Treeview Directory Help

Treeview Directory Help

Page 1 of 1

2 Replies - 3290 Views - Last Post: 20 September 2010 - 11:21 AM Rate Topic: -----

#1 BJseal91  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 68
  • Joined: 18-April 09

Treeview Directory Help

Posted 20 September 2010 - 09:49 AM

Hi I know about the good faith rules but this was more a question of guidence more than anything else which is also said is ok to ask questions about new arias of programming

I have learnt about nodes and root and childs I am using visual basic 2008 express edition and need
to add C:\ drive to the treeview so in my program I can view the contents of the c drive from a treeview
is this possible and dose anyone have any tips of where I could go or any code sniptis that would help me add C:\ directories to a treeview I am very new to treeview so that is why I have come here for help

Kind Regards

Bradley Scott

Is This A Good Question/Topic? 0
  • +

Replies To: Treeview Directory Help

#2 demausdauth  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 178
  • View blog
  • Posts: 650
  • Joined: 03-February 10

Re: Treeview Directory Help

Posted 20 September 2010 - 11:02 AM

Check out the DIC tutorials .... How to Design a basic Windows Explorer
Was This Post Helpful? 0
  • +
  • -

#3 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1055
  • View blog
  • Posts: 4,087
  • Joined: 02-July 08

Re: Treeview Directory Help

Posted 20 September 2010 - 11:21 AM

You basically write a recursive directory search. The slimmed down version.

'psuedo code
Private Sub getDirectoriesForTreeView(ByVal dir As String, node As TreeNode)
   For each directory in dir
      add new node with node text being the directory name
      to the node starting with the root node - usually
      getDirectoriesForTreeView(directory, <the new node we made>)
   Next
End Sub


If there are more directories it keeps calling our sub. I like to use the DirectoryInfo object myself.

This post has been edited by hawkvalley1: 20 September 2010 - 11:21 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1