Click here to Skip to main content
16,005,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have created three forms in C#. when i open second form I need to close previous form.
How to do this? Can anyone help me please.

Thanks
Posted
Updated 24-Sep-10 11:08am
v3

Application.Exit();
 
Share this answer
 
Call form.Close() for each form.
 
Share this answer
 
C#
foreach (Form f in Application.OpenForms)
{
    f.Close();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900