Geoff Overfield Geoff Overfield - 22 days ago 7
C# Question

change starting form c#

I started creating a forms application a couple weeks ago in C#. After going in and making some adjustments, I've added other forms and I can't seem to find an explanation of how to switch certain properties. I would like to make a form that I created later to be the initial window to open up, then navigate from there. I have no problem going from one form to the next, I just can't change it so that one of them is the first to load. I used a splash screen, but that only opens it first and then goes to the second after a time interval, rather than my button_click. I saw it the other day, but I can't remember where it is or how to access it...

Answer

Your application startup object (usually Program.cs) calls Application.Run with an instance of the first form to show. Change the startup window here.

For example, you can change

Application.Run(new Form1());

to

Application.Run(new Form2());

to show Form2 instead of Form1.