在 c#.net 中的 OpenFileDialog.Showdialog 上抛出错误
我正在 XP 机器上开发一个 Windows 应用程序。在我的一种形式中,我有一个文本框,用于显示带有 openfile 对话框路径的选定文件。另一个控件是调用 openfile 对话框的按钮。
当我单击按钮来调用打开的对话框时,我收到以下错误
表单的其余部分包含其他控件,例如数据网格和下拉列表。
请帮我解决这个问题
提前致谢。
问候, Sudarshan
更新
这是我点击按钮的代码
OpenFileDialog openfiledialog = new OpenFileDialog();
openfiledialog.Filter = "xml files|*.xml";
openfiledialog.Multiselect = false;
DialogResult dr;
dr = openfiledialog.ShowDialog();
if (dr == DialogResult.OK)
{
txtgrdDataFile.Text = openfiledialog.FileName.ToString();
}
I am developing a windows application in XP machine.in my one form i have one text box for showing the selected file with path from openfiledialog box.and the other control is button to call the openfiledialog box.
When I cliked on the button to call the open dialog box i am getting the follwing error
rest of the form contains another controls like data grid and dropdowns.
Please help me to resolve this issue
Thanx in advance.
Regards,
Sudarshan
Update
Here is my code on button click
OpenFileDialog openfiledialog = new OpenFileDialog();
openfiledialog.Filter = "xml files|*.xml";
openfiledialog.Multiselect = false;
DialogResult dr;
dr = openfiledialog.ShowDialog();
if (dr == DialogResult.OK)
{
txtgrdDataFile.Text = openfiledialog.FileName.ToString();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论