开发者

having problem with closing a form that has input

开发者 https://www.devze.com 2023-04-05 02:22 出处:网络
I want to close all forms but this code doesnt work. Could someone give me the right code? private Form0 _form0 = null;

I want to close all forms but this code doesnt work. Could someone give me the right code?

private Form0 _form0 = null;
public Form1(Form0 form0)
{
   InitializeComponent();
   form0.Hide();
   _form0 = form0;
}

form0 show a demo when user press the entrance button form1 will be shown.

private void ToolStripMenuItem7_Click(object sender, EventArgs e)
{
   Form1 form1 = new Fo开发者_如何转开发rm1(form0);
   form1.Dispose();
   form1.Close(); 
}


private void ToolStripMenuItem7_Click(object sender, EventArgs e)
{
    using(Form1 form1 = new Form1(form0))
    {
       form1.Show();
    }
}


Application.Exit(); will close all forms and entire application as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消