C#中,打开openFileDialog后,如何将选中的文件路径显示在一个文本框(textBox)中
展开全部
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "文档(*.doc;*.docx)|*.doc;*.docx";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
if (openFileDialog1.FileName != "")
{
this.textBox3.Text = openFileDialog1.FileName;
}
}
在textBox3里面显示路径。
openFileDialog1.Filter = "文档(*.doc;*.docx)|*.doc;*.docx";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
if (openFileDialog1.FileName != "")
{
this.textBox3.Text = openFileDialog1.FileName;
}
}
在textBox3里面显示路径。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询