How to add the LogicalDrives of the system to the Treeview control, as i have tried using Directory.GetLogicalDrives() , but it did not produced the output to what i was looking out for.
plz help me out with the code for windowsForm using VC#.
Regards,
RAJ
Loading
FroglegPosted Jun 18, 2012, 2:21 PM
As the user expands a part of that tree, you then load sub folders and then in a listview,any files in that folder
Getting all folders and files at the same time from each drive will stall your program
Upload your project so we can see how far you have got implement your code
RAJ KUMARPosted Jun 18, 2012, 6:21 AM
Jignesh TrivediPosted Jun 18, 2012, 5:15 AM
Try...
string[] drives = System.IO.Directory.GetLogicalDrives();
TreeNode[] nodes = new TreeNode[drives.Count()];
for (var i = 0; i < drives.Count(); i++)
{
TreeNode node = new TreeNode(drives[i]);
nodes[i] = node;
}
TreeNode treeNode = new TreeNode("Directory", nodes);
treeView1.Nodes.Add(treeNode);
Can you please give more info
how this will help you.
FroglegPosted Jun 18, 2012, 5:06 AM
System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();