表单对象自动关闭 [英] The form object closes automatically

查看:85
本文介绍了表单对象自动关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友

如果我们在form1中的按钮的click事件中编写此代码:

Hello friends

If we write this code in the click event of a button in form1:

form2 f2 = new form2();
f2.show();
this.close();



然后输出显示form2,但它会自动关闭.

我的问题是为什么?



Then then output shows the form2 but then it is automatically closed.

My question is why?

推荐答案

您要显示主表单中点击处理程序的第二种表单吗?如果是这样,那么关闭您的主窗体将终止该应用程序.
Are you showing the 2nd form from a click handler in the main form? If so, then closing your main form will terminate the application.


这篇关于表单对象自动关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆