Posts Tagged ‘Windows Appliaction’

How to set up a startup Form in Windows application





Start up page in Windows Application.

Its been an year and a half since i ve used Windows Application.So I thought of creating a Windows application.

Hope u are Familiar with Windows Forms.

An application may ( may not )contain Many forms.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.In , case if we need to change the default Form and select another form as the Start up form.We need to follow certain steps. Those Steps to be followed are given below.

*** Open the Solution explorer, You can use the short cut to open it. Ctrl+Alt+L
*** Open open the program .cs File.
You will see the code shown below in it. Replace the Form1 Name with the name of the form which you want to set up the First page.

In C#:

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


Here we use the Application class ,
The Application class provides static methods to manage an application like running, closing, and managing windows messages. In the method Main of the application we can start running the application using the Run of the Application class.To stop Running the application we can call Exit Method .

HappyCoding ! 😉