-
Closing Form
Can anyone help me out from closing one form from another form, may be Form1 was my first form and i have added Form2 to that application as new item, now i want that when anyone clicks on the "Show Form2" button, Form2 should be showed and Form1 should get closed. Please help me out soon.:)
-
Re: Closing Form
From first form:
Code:
private void button1_Click_1(object sender, EventArgs e)
{
Form2 frm = new Form2();
this.Visible=false;
frm.Show();
}
From second form:
Code:
private void Form2_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
}
-
Re: Closing Form
How about closing the main application and before closing you want to do some processing. For example, before closing all created files must be deleted.
In C++ you can do that in the constructor of the main class, but how is that is Visual C#?
-
Re: Closing Form
Ok, I got it:
private void MainMap_FormClosed(object sender, FormClosedEventArgs e)
{
}
Create eventhandler in MainForm.designer by dubbleclicking in the propperty item. and do some terminating processes.