Begins running a standard application message loop on the current thread, and makes the specified form visible.
[Visual Basic] Overloads Public Shared Sub Run( _ ByVal mainForm As Form _ ) [C#] public static void Run( Form mainForm ); [C++] public: static void Run( Form* mainForm ); [JScript] public static function Run( mainForm : Form );
Exception Type | Condition |
---|---|
InvalidOperationException | A main message loop is already running on the current thread. |
Typically, the main function of an application calls this method and passes it to the main window of the application.
This method adds an event-handling method to mainForm for the System.WinForms.Form.Closed event. The event-handling method will call ExitThread to clean up the application.
NGWS Runtime Security:
UIPermission | You must have the System.security.Permissions.UIPermission for AllWindows to set this method. |
Application Class | Application Members | System.WinForms Namespace | Application.Run Overload List | Exit | ExitThread | DoEvents