How to setup the starting form of a winforms project in Visual Studio 2010

前端 未结 4 1359
别跟我提以往
别跟我提以往 2020-12-03 16:49

Does anybody know how to setup the starting form of a winforms project in Visual Studio 2010? I have ridden to go to Project Properties and change Startup Object, but in dow

相关标签:
4条回答
  • 2020-12-03 17:28

    It is not only in Program.cs. It is in any class where exists a "static Main()" function. Programs.cs is made for you by the IDE on certain type of project. It's not a must.

    Example:

        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.DoEvents();
            Application.Run(new Form2());
        }
    

    The project properties, tab: "Application" show a dropdown with every class that as a static Main() function. You could choose the one you want from there.

    0 讨论(0)
  • 2020-12-03 17:36

    In your Program.cs, there is line like:

    Application.Run(new Form1());
    

    where you can substitute the form you'd like to start. If you change Form1 to another Form class, your project will start with that one.

    0 讨论(0)
  • 2020-12-03 17:40

    in visual studio on the menu bar: project > project properties > start up form : select the form within your project that you want to run on start up.

    0 讨论(0)
  • 2020-12-03 17:52

    Go to 'Tools' and click on 'Options'.

    Next, go on the 'Startup' option within the 'Environment' category, and select 'Show Start Page' from the drop down menu.

    0 讨论(0)
提交回复
热议问题