Display System Directory

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2007
Posts: 252
Reputation: ProfessorPC is an unknown quantity at this point 
Solved Threads: 27
ProfessorPC ProfessorPC is offline Offline
Posting Whiz in Training

Display System Directory

 
0
  #1
Aug 28th, 2009
I am wanting to display the PC's System Directory in a treeview. I have been searching for how to do this for some time now without finding anything. if anybody can help me out i would greatly appreciate it.

thanks
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 270
Reputation: GeekByChoiCe is on a distinguished road 
Solved Threads: 55
GeekByChoiCe GeekByChoiCe is offline Offline
Posting Whiz in Training

Re: Display System Directory

 
1
  #2
Aug 28th, 2009
try this:
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. treeDir.Nodes.Clear()
  3. CreateDirTree(Nothing, Environment.SystemDirectory)
  4. End Sub
  5.  
  6. Private Sub CreateDirTree(ByVal fromNode As TreeNode, ByVal basePath As String)
  7. Dim newDir As TreeNode
  8. Dim subDir As String
  9.  
  10. For Each singleDir As String In My.Computer.FileSystem.GetDirectories(basePath)
  11. subDir = My.Computer.FileSystem.GetName(singleDir)
  12.  
  13.  
  14. If fromNode Is Nothing Then
  15. newDir = treeDir.Nodes.Add(subDir)
  16. Else
  17. newDir = fromNode.Nodes.Add(subDir)
  18. End If
  19.  
  20. CreateDirTree(newDir, My.Computer.FileSystem.CombinePath(basePath, subDir))
  21. Next singleDir
  22. End Sub
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 244 | Replies: 1
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC