//文件对话框(选择文件)
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = "d:\\";
ofd.DefaultExt = "*.TXT|*.txt";
ofd.Filter = "*.TXT|*.txt";
ofd.Multiselect = false;
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string zdbPath = ofd.FileName;
}
//文件夹对话框(选择文件夹)
FolderBrowserDialog pFolder = new FolderBrowserDialog();
pFolder.ShowNewFolderButton = false;
pFolder.Description = "请选择路径:";
if (pFolder.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string selectPath = pFolder.SelectedPath;
}
//保存文件对话框
SaveFileDialog saveDG = new SaveFileDialog();
saveDG.Filter = "Excel文件|*.xls";
if (saveDG.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string savePath = saveDG.FileName;
}
//判断选择对话框
if (MessageBox.Show("是否继续执行", "系统提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
{ return; }