I would like to reopen a closed windows form in c#.
I actually actively close the form to allow autoIT scripts to run on a different windows application. However I would like to reopen the same form after the scripts are done.
So…
this.Close();
.
.
.
Application.Run(new FormTestPage());
However this gives me an error that says to use Form.ShowDialogue instead.
I’m unsure how that works.
Thanks in advance!!
If you close the main form and you started the application with
Then closing the main form will also close the application. Start the application like this instead
Now when the application has to close, you must call
Exit(because it is not closed automatically anymore):You can do this in the main form in the
FormClosedevent when you are not just closing the form temporarily.Now you can reopen the form normaly with: