Windows窗体中的窗体调用问题 [英] Form calling problem in Windows form

查看:76
本文介绍了Windows窗体中的窗体调用问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C#Windows窗体制作应用程序,我有两个Form(form1和form2).
Form1包含按钮,如果我单击Form1按钮,则Form2打开,而Form1将关闭,那么问题是form2打开,但Form1将不会关闭,请Plz帮助我做、、、、、、、

i am making an application in C# windows form,, I have two Form (form1 and form2).
Form1 consist of button,, If I click the Form1 button then Form2 is open and Form1 will is close,, then problem is form2 is open but form1 will not close,, Plz help what i do,,,,,,,,

推荐答案

我假设您在form1中有一个名为button1的按钮,然后尝试一下.
i assume you have a button in form1 named button1.then try this..
private void button1_Click(object sender, EventArgs e)
{
    this.Hide();           //this will hide form1
    Form2 f2 = new Form2();
    f2.Show();             //this will show form2
}


这篇关于Windows窗体中的窗体调用问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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