When the autogenerated code for my program starts, it calls

Application.Run(new Form1());

and starts Form1. I have another form I'd like to switch to and close Form1 at the same time. The problem is if I use this.Close() in Form1 before I call the other form with Form.ShowDialog() then the program ends. If I put it after ShowDialog then it remains up in the background until I close Form2, at which point the program ends.

How can I spawn a copy of Form2 while closing the currently opened frame at the same time?

Edit: I have tried calling Form2 with .Show() as well, but the new frame closes instantly.

Edit
Report