c#怎么获取用户选择文件路径
1、// 选择文件:private string SelectPath(){ string path = strin爿讥旌护g.Empty; var openFileDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "Files (*.*)|*.*"//如果需要筛选txt文件("Files (*.txt)|*.txt") }; var result = openFileDialog.ShowDialog(); if (result == true) { path = openFileDialog.FileName; } return path}// 选择路径private string SelectPath(){ string path = string.Empty; System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { path = fbd.SelectedPath; } return path;}
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:23
阅读量:39
阅读量:56
阅读量:27
阅读量:94