本文介绍了c#-关闭浏览对话框导致表单关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个通过以下方式显示的表单: ShowDialog()
。
该表单未指定 CancelButton
。
I have a form which is displayed through: ShowDialog()
.The form doesn't have CancelButton
specified.
当我从表单中打开 BrowseDialog
,然后关闭 BrowseDialog
,该窗体也被关闭。如何防止这种情况发生?
When I open a BrowseDialog
from the form and then close the BrowseDialog
, the form is also closed. How can I prevent this from happening?
单击浏览按钮时:
browseDialog.SelectedPath = projectLocation.Text;
browseDialog.ShowDialog();
if (browseDialog.SelectedPath != "")
{
projectLocation.Text = browseDialog.SelectedPath;
}
单击表单的取消按钮时:
Close();
推荐答案
我想您用来显示
如果不是这种情况,请发布一些代码。
If this is not the case, please post some code.
这篇关于c#-关闭浏览对话框导致表单关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!