FolderBrowserDialog fbdlg = new FolderBrowserDialog();
fbdlg.Description = "请选择文件路径";
if (fbdlg.ShowDialog() == DialogResult.OK)
{
string foldPath = fbdlg.SelectedPath;
textBox1.Text = foldPath;
return;
DirectoryInfo theFolder = new DirectoryInfo(foldPath);
FileInfo[] dirInfo = theFolder.GetFiles();
//遍历文件夹
foreach (FileInfo file in dirInfo)
{
MessageBox.Show(file.ToString());
}
}
亲爱的:若该文章解决了您的问题,可否收藏+评论+分享呢?
文章评论 本文章有个评论