Unload a form

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hi,
I have a question as below:
* window application
* C#
* if I load a form, I code as
Application.Run(new Form1);
* if I click a button, to unload a form, and load form2
* how to unload the form.
* Once I unload it, it shold be correct to code
Application.Run(new Form2);
Please advice. Thanks.
Peter
 
* "Peter said:
I have a question as below:
* window application
* C#
* if I load a form, I code as
Application.Run(new Form1);
* if I click a button, to unload a form, and load form2
* how to unload the form.
* Once I unload it, it shold be correct to code
Application.Run(new Form2);
Please advice. Thanks.

Why not simply show the 1st form by calling its 'Show' method, then call
'Application.Run()'. Later you can close forms by calling their 'Close'
method and show an other form. You can exit the application by calling
'Application.ExitThread' after closing all windows.
 
Back
Top