foreach (System.IO.DriveInfo drive in System.IO.DriveInfo.GetDrives())
{
TreeNode node = new TreeNode();
node.Value = drive.Name;
//Make sure the drive is ready before we access it
if (drive.IsReady)
{
node.Text = drive.Name + " - (free space: " + drive.AvailableFreeSpace + ")";
this.TreeView1.Nodes.Add(node);
}
else
{
node.Text = drive.Name + " - (not ready)";
this.TreeView1.Nodes.Add(node);
}
}
Thursday, February 4, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment