本文介绍了显示msgbox,要求在尝试打开新的子窗体时关闭打开的子窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的申请中有12个表格.我想显示一个消息框,要求用户在打开其他窗体之前先关闭现有的打开的子窗体.
我尝试了以下代码:
Hi,
I m having 12 forms in my application. I want to display a message box asking the user to close the existing opened child form before opening other.
I had tried the following the code:
Form curfrm;
String a = " Please Close other open window ";
private void admissionForm1ToolStripMenuItem_Click(object sender, EventArgs e)
{
adfrm1 af1 = new adfrm1(null);
if (curfrm != null)
{
MessageBox.Show(a);
return;
}
else
{
curfrm = af1;
af1.MdiParent = this;
af1.Show();
}
这不允许我在关闭子窗体后再打开其他窗体.
谢谢.
This doesn''t allow me to open the other forms after closing the child form.
Thanks.
推荐答案
if GlobalToken = "" then
GlobalToken = CurrentForm.Name
else
Show Message
end if
在所有子窗体上,使用析构函数"清除令牌-
On all the child forms'' destructor clear the token -
GlobalToken = ""
这篇关于显示msgbox,要求在尝试打开新的子窗体时关闭打开的子窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!