-
Common Dialog Box in C#?
Hi, can anyone recommend a good example site or provide an example on how to use a common dialog box in C#? The one on MSDN is confusing to me.
My program processes .csv files. My goal is to be able to point my program to a directory file which holds the .csv files at the start of the program. Also, I want the user to be able to choose the directory where the program outputs the processed output.
Thank You.
Steve
-
Code:
[STAThread]
static void Main(string[] args)
{
using (FolderBrowserDialog dialog = new FolderBrowserDialog())
{
//Set the root folder
dialog.RootFolder = Environment.SpecialFolder.Desktop;
//Set the currently selected directory
dialog.SelectedPath = Environment.CurrentDirectory;
//Do you want to allow the user to create folders in this dialog?
dialog.ShowNewFolderButton = true;
//A meaningful description
dialog.Description = "This is a description";
if(dialog.ShowDialog() == DialogResult.OK)
MessageBox.Show(dialog.SelectedPath);
}
}
-
-
Pianorain: How can I specify a specific file to use, rather then just a folder?
-
You'll want to use the OpenFileDialog class.
-