C#中,打开openFileDialog后,如何将选中的文件路径显示在一个文本框(textBox)中

十分急...请懂得如何解决的大师帮帮忙..谢谢你们!!!
2025-01-07 00:21:45
推荐回答(1个)
回答1:

OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "文档(*.doc;*.docx)|*.doc;*.docx";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
if (openFileDialog1.FileName != "")
{
this.textBox3.Text = openFileDialog1.FileName;
}
}
在textBox3里面显示路径。