// Code in C#
//Get System Drives
public static void getSystemDrives(ComboBox cmbBox)
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
if (d.IsReady)
{
cmbBox.Items.Add((object)d.Name);
}
}
if (cmbBox.Items.Count > 0)
{
cmbBox.SelectedIndex = 0;
}
}
No comments:
Post a Comment