| | |
populating treeview with disk drives
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 29
Reputation:
Solved Threads: 1
Hello everyone.
Can anyone give a link to a good guide/tutorial on how to populate a treeview with the drives of a system. I am able to get the drives listed, but am i having a problem creating the child nodes for the drives and really have never used a tree view before. Any info is appreciated.
Below is what i have tried ( just to show my attempt). i know its wrong, so any tutorials or advice is appreciated.
Can anyone give a link to a good guide/tutorial on how to populate a treeview with the drives of a system. I am able to get the drives listed, but am i having a problem creating the child nodes for the drives and really have never used a tree view before. Any info is appreciated.
Below is what i have tried ( just to show my attempt). i know its wrong, so any tutorials or advice is appreciated.
vb Syntax (Toggle Plain Text)
Imports System.IO Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load With tvDrives .BeginUpdate() For Each dr As DriveInfo In DriveInfo.GetDrives() .Nodes.Add(dr.Name) Next .EndUpdate() End With End Sub Private Sub tvDrives_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvDrives.AfterSelect With tvDrives For Each dr As DriveInfo In DriveInfo.GetDrives() Dim dir As New DirectoryInfo(dr.Name) ' i want to try and use the selected node, but i am having trouble figuring this out and i just used this instead to make it work temporarily. .ShowPlusMinus = True For Each d As DirectoryInfo In Dir.GetDirectories() Dim count As Integer = 0 .Nodes(count).Nodes.Add(d.Name) count += 1 Next Next End With End Sub End Class
Look, you reached to very good phase.. what you need is to know how to go through nested directories. I believe you can do it on your own.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: DATABASE
- Next Thread: small issues...
Views: 827 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
"crystal .net .net2005 2008 access add advanced application array assignment basic box button buttons center click code combo convert cpu data database datagrid datagridview dissertation dissertations dissertationthesis dosconsolevb.net editvb.net employees error excel exists firewall function image images isnumericfuntioncall listview login map math memory mobile module msaccess mssqlbackend mysql navigate net number opacity page pan picturebox picturebox2 port print printing printpreview problem record regex reports" reuse right-to-left save savedialog search serial socket sorting sql sqldatbase storedprocedure string structures studio temp textbox timer txttoxmlconverter upload useraccounts usercontol usercontrol vb vb.net vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet vista visual visualbasic visualbasic.net visualstudio2008 web winsock wpf xml






