opening and closing windows forms
I have 2 forms, form1 and form2.
All I wanna do is open form2 from form1 (using a button on form1). Then close form1 so that just form2 is showing.
I also want a button on form2 that will close the application.
The above tasks are very easy in VB6 code - it seems a little tricky in C#.
Anyone help/advise me?
thanks
Re: opening and closing windows forms
Quote:
Originally posted by Claxer
The above tasks are very easy in VB6 code - it seems a little tricky in C#.
This is because .Net is more object oriented.
When you start an windows form application, you are loading and showing a 'start' form. When that form is closed, the application thread dies and hence, the whole application is closed.
As mentioned, you can load form1, do what you need to do, create form2, pass a reference of form one to it, then hide form1 (don't close it). Since form1 is still in memory running and hasn't been closed, the app will continue to run.