- FolderBrowserDialog dia = new FolderBrowserDialog();
- if (dia.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- string filePath = dia.SelectedPath;
-
- Directory.Exists(filePath);
- }
-
-
- OpenFileDialog dia = new OpenFileDialog();
- if (dia.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- string filePath = dia.SelectedPath;
-
- File.Exists(filePath);
- }
C#Winform判断文件和路径是否存在
原文:http://www.cnblogs.com/shenbing/p/5986734.html