标签:
// 获取文件夹绝对路径 显示在 txtbox 控件里
System.Windows.Forms.FolderBrowserDialog folder =
new System.Windows.Forms.FolderBrowserDialog();
if (folder.ShowDialog() == DialogResult.OK)
{
this.txtboxPath.Text = folder.SelectedPath;
}
// 获取文件和路径名 一起显示在 txtbox 控件里
OpenFileDialog dialog = new OpenFileDialog();
if (dialog .ShowDialog() == DialogResult.OK)
{
this.txtboxPath.SelectedText = dialog.FileName;
}
//如果只显示文件名
OpenFileDialog dialog = new OpenFileDialog();
if (dialog .ShowDialog() == DialogResult.OK)
{
this.txtboxPath.SelectedText = dialog.SafeFileName;
}
//原文链接http://www.cnblogs.com/zhangzhu/archive/2013/06/01/3112601.html
标签:
原文地址:http://www.cnblogs.com/zixue-233/p/5347340.html