Deborah's Developer MindScape






         Tips and Techniques for Web and .NET developers.

December 15, 2010

Setting a Form as a Startup Form with Visual Studio

Filed under: C#,VB.NET,WinForms @ 4:03 pm

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!

1 Comment

  1.   Aly Lero — April 2, 2011 @ 2:55 pm    Reply

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

RSS feed for comments on this post. TrackBack URI

Leave a comment

*

© 2014 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs