C# 选择文件夹 选择文件

C# 选择文件夹 选择文件
选择文件
1 //选择文件
2 OpenFileDialog dialog = new OpenFileDialog();
3 dialog.Multiselect = true;//该值确定是否可以选择多个文件
4 dialog.Title = "请选择文件夹";
5 dialog.Filter = "所有文件(*.*)|*.*";
6 if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
7 {
8     string file = dialog.FileName;
9 }

选择文件夹

1  FolderBrowserDialog dialog = new FolderBrowserDialog();
2             dialog.Description = "请选择文件路径";
3             dialog.SelectedPath = path;
4             //dialog.RootFolder = Environment.SpecialFolder.Programs;
5             if (dialog.ShowDialog() == DialogResult.OK)
6             {
7                 string foldPath = dialog.SelectedPath;
8 }

 

posted on 2017-09-07 12:03 高软玩家 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/qc-id-01/p/7489021.html

你可能感兴趣的:(C# 选择文件夹 选择文件)