How to run visual studio from current form instead of startup form just to check the new form

Anonymous
2023-02-01T11:44:11.7733333+00:00

Hi

How to run visual studio from current form instead of startup form just to check the new form

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,604 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Reza Aghaei 4,936 Reputation points MVP
    2023-02-01T20:08:47.3533333+00:00

    These are the ways that you can determine the startup form:

    1. In C#, the main entry point is main method which is usually in Program.cs. So open Program.cs and set the form in Application.Run(new Form2()).
    2. In VB.NET. open project properties and in the Application tab, in the Startup form dropdown, choose the form that you want, for example Form2.
    3. In VB.NET if application framework is not enabled, then it works like C#, and a main method is the main entry point and you need to specify the startup form in Application.Run.
    4. In VB.NET, in solution explorer, click on the Show all files toolbar button, then under the Properties folder, open Application.myapp file and set the start up form like this: <MainForm>Form2</MainForm>

    I can imagine creating a Visual Studio extension to set the startup form, but the thing is sometime, the startup is not necessarily a Form, and you have different logic in startup for different purposes, for example to handle the command line arguments; in this case, you may have different startup forms based on different parameters, for example for print, for sending a message, for login, etc.

    1 person found this answer helpful.