| | |
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...
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array arrays basic bing button buttons c# center check checkbox code convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output panel passingparameters picturebox picturebox1 port position print printing problem project read remove save searchbox searchvb.net select serial server shutdown soap sorting survey table tcp temperature text textbox timer timespan toolbox trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year






