Thursday, November 12, 2009

Example for FolderBrowserDialog

this.folderBrowserDialog1.ShowNewFolderButton = false;

this.folderBrowserDialog1.RootFolder = System.Environment.SpecialFolder.MyComputer;


DialogResult result = this.folderBrowserDialog1.ShowDialog();

if (result == DialogResult.OK)
{
string foldername = this.folderBrowserDialog1.SelectedPath;
textBox1.Text = foldername;

foreach (string f in Directory.GetFiles(foldername))
{
this.listBox1.Items.Add(f);
}

}

No comments: