How to get system Folder name bind to Dropdownlist

Mittaikariss
Posted by Mittaikariss under C# category on | Points: 40 | Views : 1745


DirectoryInfo dd= new DirectoryInfo("D:\\image\\");
DirectoryInfo[] ddddd= dd.GetDirectories();
//DirectoryInfo dri = default(DirectoryInfo);
foreach (DirectoryInfo dinfo in ddddd)
{
DropDownList1.Items.Add(dinfo .Name);
}




http://www.invomtech.com/

Comments or Responses

Posted by: T.saravanan on: 1/30/2012 Level:Silver | Status: [Member] [MVP] | Points: 10
Hi,

Nice info. Just mentioned in your code, For DirectoryInfo using the following namespace --> Using System.IO.

One more thing to get files from that folder using the below code...

DirectoryInfo dd= new DirectoryInfo("D:\\image\\");

FileInfo[] file = dd.GetFiles();

Login to post response