首页 > 代码库 > 2016.2.17文件夹选择框及文件选择框
2016.2.17文件夹选择框及文件选择框
string fpth = "";
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Title = "请选择走向文件";
openFileDialog.Filter = "文本文件|*.txt";
openFileDialog.RestoreDirectory = true;
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
fpth = openFileDialog.FileName;
}
if (fpth == "") return;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
FolderBrowserDialog folderDlg = new FolderBrowserDialog();
folderDlg.ShowNewFolderButton = false;
folderDlg.SelectedPath = Directory.GetCurrentDirectory();
folderDlg.Description = "选择脚本sql文件存放路径";
if (folderDlg.ShowDialog() == DialogResult.OK)
{
tb_sqlpath.Text = folderDlg.SelectedPath;
NavChina.Common.APPConfig.GetAPPConfig().SetConfigValue("SqlFilePath", tb_sqlpath.Text);
}
2016.2.17文件夹选择框及文件选择框