// 获取文件夹绝对路径 显示在 txtbox 控件里
System.Windows.Forms.FolderBrowserDialog folder = new System.Windows.Forms.FolderBrowserDialog();
if (folder.ShowDialog() == DialogResult.OK)
{
textBox1.Text = folder.SelectedPath;
}
// 获取文件和路径名 一起显示在 txtbox 控件里
<span style="font-size:12px;">OpenFileDialog dialog = new OpenFileDialog();
if (dialog .ShowDialog() == DialogResult.OK)
{
textBox1.Text = dialog.FileName;
} //如果只显示文件名OpenFileDialog dialog = new OpenFileDialog();if (dialog .ShowDialog() == DialogResult.OK){
textBox1.Text = dialog.SafeFileName;
}