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

FroglegRank #1,020 · 1.9K reputationPosted Jun 18, 2012, 1:06 AM EDT
System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();
Jignesh TrivediRank #16 · 50.3K reputationPosted Jun 18, 2012, 1:15 AM EDT
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.
RAJ KUMAR4 reputationPosted Jun 18, 2012, 2:21 AM EDT
FroglegRank #1,020 · 1.9K reputationPosted Jun 18, 2012, 10:21 AM EDT
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