Monday, November 24, 2003

Directory Picker Pro in C#


In my latest project I needed a dialog for picking a directory. I searched through the web, but found nothing that looked nice. First of all I wanted a TreeView for display, and I wanted to view all system drives (with correct names and icons).


How to use:

DirPicker DP = new DirPicker();
DP.ShowDialog();
if(DP.Result==DirectoryPickerResponse.Ok)
{
MessageBox.Show("Ok: "+ DP.SelectedDirectory);
}
else
{
MessageBox.Show("Cancel!");
}

Simple huh?


Go to the url above for source code.