打开以对话框,获取文件夹路径 、文件的路径、文件名123456789101112131415161718192021222324252627// 获取文件夹绝对路径 显示在 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; }工欲善其事,必先利其器。 相关链接(侵删) C# 打开以对话框,获取文件夹路径 、文件的路径、文件名 =================我是分割线================= 欢迎到公众号来唠嗑: