This documentation is archived and is not being maintained.

WindowsFormsApplicationBase.OnStartup Method

When overridden in a derived class, allows for code to run when the application starts.

Namespace:  Microsoft.VisualBasic.ApplicationServices
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

protected virtual bool OnStartup(
	StartupEventArgs eventArgs


Type: Microsoft.VisualBasic.ApplicationServices.StartupEventArgs
StartupEventArgs. Contains the command-line arguments of the application and indicates whether the application startup should be canceled.

Return Value

Type: System.Boolean
A Boolean that indicates if the application should continue starting up.

By default, this method raises the Startup event. The event handler can set the Cancel property of the event argument. If Cancel is True, this method returns False to cancel the application startup. Otherwise, this method returns True.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.