I have some code here:
private void button1_Click(object sender, EventArgs e)
{
Application.Run(new Form3());
}
Although I don’t think this is how you are meant to change forms, when I ran it, it threw an error stating:
Starting a second message loop on a
single thread is not a valid operation
You cannot use
Application.Run– that is for starting windows form application (internal message loop which is shared among all forms in the application), not for showing a form. Each form hasShowandHidemethod so you should simply call:But you should not create form each time you want to show it. If you want to have only one instance of the form you should keep it as global and only show or hide it on demand. Otherwise you will have to call
Closeinstead ofHideto clear all resources the form consumes.