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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top