Application.Run in Windows Forms Application

Published on July 26, 2012 by abundantcode

Filed under Windows Forms

Last modified July 26, 2012

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 6519 times

When a new Windows Forms Project is created , you would see the sourcecode similar to the below sample in the Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    static class Program
    {
        [STAThread]
        static void Main()
        {          
            Application.Run(new Form1());
        }
    }
}

What does the Application.Run do ?

The Application.Run will run the standard application message loop in the current thread where the Application runs.

The Application.Run also takes the parameter of type Form

Application.Run(new Form1());

In this case , the specified form is made visible too.

Leave a Comment


x

You might be Interested in these Posts

How to delete user account from command line in Windows 10 ?

You can delete a user account from command line in Windows 10 using the net user command and specify...

How to add new user account from command line in Windows 10 ?

You can add a new user account in Windows 10 using command prompt using the net user command and pas...

How to open display settings from command line in Windows 10 ?

The display properties can be found in the settings app in Windows 10 which lets the users to config...