Click here to Skip to main content
15,891,409 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
How to set property on single time only one form open in windows application
Posted
Comments
BillWoodruff 27-Jan-15 3:29am    
Assuming this is a WinForms application: without knowing what Form is the "Main Form," it's hard to give you advice.

Are both the forms you mention here ... the one to close, the other to open ... created by a Main Form ? Or, is one of them the Main Form. Is the Form that is closed you now wish to open just hidden, or has it not been created yet ?

Details, please.

1 solution

You need to close the first form when opening the second one.

Its easy you just go to your button that opens Form2 and write in the Code:

Close();

this will close Form1 and after that you put in your code that opens your second form.
 
Share this answer
 
v2

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