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

                    Common.APPConfig.GetAPPConfig().SetConfigValue("SqlFilePath", tb_sqlpath.Text);

                }

    同时选多种后缀用;隔开:openFileDialog.Filter = "Excel|*.xls;*.xlsx";

  • 相关阅读:
    r语言
    pickle模块
    mongodb简介
    oracle
    mysql
    ceph
    迭代器
    python类
    encode&decode
    PHP 截取字符串中某两个字符(串)之间的字符串 考虑多个的情况
  • 原文地址:https://www.cnblogs.com/mol1995/p/5964958.html
Copyright © 2020-2023  润新知