```
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());
}
}
```