码迷,mamicode.com
首页 > 其他好文 > 详细

2016.5.9 文件选择和文件夹选择对话框

时间:2016-10-15 19:43:33      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:

1、文件夹选择

            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);

            }

 

            ////

            2、文件选择

            string fpth = "";

            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title = "请选择走向文件";

            openFileDialog.Filter = "文本文件|*.sql";

 

            openFileDialog.RestoreDirectory = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)

            {

                fpth = openFileDialog.FileName;

                tb_sqlpath.Text = fpth;

                //NavChina.Common.APPConfig.GetAPPConfig().SetConfigValue("SqlFilePath", fpth);

            }

2016.5.9 文件选择和文件夹选择对话框

标签:

原文地址:http://www.cnblogs.com/mol1995/p/5964993.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!