zoukankan      html  css  js  c++  java
  • WPF 打开文件、文件夹

    打开文件代码:

        OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Title = "选择数据源文件";
                openFileDialog.Filter = "txt文件|*.txt";
                openFileDialog.FileName = string.Empty;
                openFileDialog.FilterIndex = 1;
                openFileDialog.Multiselect = false;
                openFileDialog.RestoreDirectory = true;
                openFileDialog.DefaultExt = "txt";
                if (openFileDialog.ShowDialog() == false)
                {
                    return;
                }
               string  txtFile = openFileDialog.FileName;

    打开文件夹代码:

        System.Windows.Forms.FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
                folderBrowserDialog.Description = "选择Word文档生成的文件夹";
                folderBrowserDialog.ShowNewFolderButton = false;
                folderBrowserDialog.RootFolder = Environment.SpecialFolder.Personal;
                folderBrowserDialog.ShowDialog();
                if (folderBrowserDialog.SelectedPath == string.Empty) 
                {
                    return;
                }
                string wordFolder = folderBrowserDialog.SelectedPath;

  • 相关阅读:
    react的50个面试题
    什么是宏队列跟微队列
    宏队列与微队列
    数组都有哪些方法
    vuex 跟 vue属性
    高阶组件
    如何创建视图簇(View cluster)-SE54/SM34
    ◆◆0如何从维护视图(Maintenace view)中取数据-[VIEW_GET_DATA]
    ◆◆0如何在SM30维护表时自动写入表字段的默认值-事件(EVENT)
    ◆◆0SAP Query 操作教程
  • 原文地址:https://www.cnblogs.com/alsofly/p/3373904.html
Copyright © 2011-2022 走看看