Reputation: 930
I've a DropDownList and i need to fill it with number of drives available in my computer like C:\, D:\ etc... so how can i do this one? help me.
Thanks, @nagaraju.
Upvotes: 0
Views: 223
Reputation: 94643
Use System.IO.DriveInfo
class.
System.IO.DriveInfo []drives = System.IO.DriveInfo.GetDrives();
foreach(var drive in drives)
{
DropDownList1.Items.Add(drive.Name);
}
Upvotes: 1