Click here to Skip to main content
15,885,890 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to setup start up form in C#
Posted

Main application form is the one used as the argument in System.Windows.Forms.Application.Run. This form is used as a start-up one.

At the same time, some form can be shown before even starting application using System.Windows.Forms.Form.Show, or System.Windows.Forms.Form.ShowDialog and be a part of the application, but the main form will be the same as the one used as the argument in System.Windows.Forms.Application.Run. In this way, the start-up form and main form can be different. This trick will work but it is pretty unusual.

—SA
 
Share this answer
 
v2
Comments
Abhinav S 11-May-11 0:55am    
My 5.
Sergey Alexandrovich Kryukov 11-May-11 15:05pm    
Thank you, Anhinav.
--SA
Ragi Gopi 11-May-11 0:57am    
while checking each form in a project, is there any way to change the start form temporary.
Sergey Alexandrovich Kryukov 11-May-11 0:58am    
When the application is already running, the term "start form" makes no sense.
If you explain what do you mean by "start from" in this context, I'll answer.
--SA
Sergey Alexandrovich Kryukov 11-May-11 1:08am    
And you cannot change main form. (Probably, this is what you wanted.)
More exactly, the way to do it is to terminate your instance of System.Windows.Forms.Application (by Application.Terminate) and run Application.Run again.

Trust me: if you want to do this, you will spend too much time to smooth out the logic of your application to make it working. Want to try? Go ahead, I explained the idea.

--SA
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 11-May-11 1:05am    
Abhinav, this reference needs explanation which Microsoft does not do by some reason. The project Properties "Startup Object" does not decide which is the start-up or main form! It selects the class where the entry point is. (So, it could be "main", but it could be something else; for example, it is required to set if there are more than one "main" of required signature.)

As a result, there can be different versions of the entry point, one is statically selected in a project. And only as a result of this, there can be different main forms. The rest of it works as I described in my answer. (My 4 for this one.)

--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900