-
July 3rd, 2007, 04:28 AM
#1
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.
-
July 3rd, 2007, 05:02 AM
#2
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();
}
Bogdan
If someone helped you then please Rate his post and mark the thread as Resolved
Please improve your messages appearance by using tags [ code] Place your code here [ /code]
-
July 3rd, 2007, 05:07 AM
#3
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#?
-
July 3rd, 2007, 05:14 AM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|