Setting a Form as a Startup Form with Visual Studio

Posted Wed, Dec 15 2010 14:03 by Deborah Kurata

The startup form is the first form that is launched when your application is executed. By default, a Windows Forms project creates a default form when the project is created. This form is set as the startup form.

You can change the startup form to any form within your application following the steps below. In this example, the report form is set as the startup form for testing purposes.

To Set a Form as a Startup Form:

In C#:

Modify the Program.cs file as follows:

static void Main()
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new ReportWin());
}

In VB:

1) Double-click on My Project under the project in Solution Explorer.

2) Click the Application tab.

3) Set the Startup form.

image_thumb10

Use this technique any time you want to change the start up form for the application.

Enjoy!

Filed under: , , , , ,

Comments

# Reporting in .NET

Wednesday, December 15, 2010 4:11 PM by Deborah's Developer MindScape

Most business applications require some type of reporting. Why bother with all of the CRUD (create, review

# re: Setting a Form as a Startup Form with Visual Studio

Saturday, April 02, 2011 2:55 PM by Aly Lero

How do you do it for C++ in Visual Studio 2010 Professional?  I can't seem to find an option for it.

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above: