我是靠谱客的博主 安静红牛,这篇文章主要介绍C# Winform 选择文件夹和选择文件,现在分享给大家,希望可以做个参考。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public bool showDialogGetExcel(out string excelName) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = @"Excel文件|*.xls;*.xlsx"; openFileDialog.RestoreDirectory = true; openFileDialog.FilterIndex = 1; bool dialogResult = openFileDialog.ShowDialog() == DialogResult.OK; excelName = openFileDialog.FileName; return dialogResult; } public bool showDialogGetSaveFolder(out string folderPath) { FolderBrowserDialog dlg = new FolderBrowserDialog(); bool dialogResult = dlg.ShowDialog() == DialogResult.OK; folderPath = dlg.SelectedPath.ToString(); return dialogResult; }

最后

以上就是安静红牛最近收集整理的关于C# Winform 选择文件夹和选择文件的全部内容,更多相关C#内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(62)

评论列表共有 0 条评论

立即
投稿
返回
顶部