1.拖动一个openFileDialog1到窗体
2.写代码:
this.openFileDialog1.Filter="*.txt|*.txt|所有文件(*.*)|*.*";
if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
{
string Name=this.openFileDialog1.FileName;
}
if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
{
string Name=this.openFileDialog1.FileName;
}