My.Application.SplashScreen Property
Gets or sets the splash screen for this application.
' Usage
Dim value As System.Windows.Forms.Form = My.Application.SplashScreen
' Declaration
Public Property SplashScreen As System.Windows.Forms.Form
Return Value
A Form object that the application uses as the splash screen.
Exceptions
The following condition can cause an exception:
- The same value assigned to this property and the My.Application.MainForm property (ArgumentNullException).
Remarks
The My.Application.SplashScreen property allows you to get or set the Form object that the application uses as the splash screen, the first graphic form that is displayed while an application is being started.
This property supports the Visual Basic Application model. For more information, see Overview of the Visual Basic Application Model.
The changes to this property are not persisted when the application closes. To change the splash screen permanently, you must change the setting in the Project Designer. For more information, see How to: Specify a Splash Screen for an Application (Visual Basic).
Example
This example uses the My.Application.SplashScreen property and the My.Application.Startup event to update the splash screen with status information as the application starts.
Private Sub MyApplication_Startup( _
ByVal sender As Object, _
ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs _
) Handles Me.Startup
' Get the splash screen
Dim splash As SplashScreen1 = CType(My.Application.SplashScreen, SplashScreen1)
splash.Status = "Connecting to the database..."
' Insert code to connect to the database
splash.Status = "Downloading updates..."
' Insert code to download updates
End Sub
This example requires that the project have a splash screen named SplashScreen1
. The splash screen needs to have a property named Status
that updates its user interface.
You must enter this code in the Code Editor window for application events. For more information, see How to: Handle Application Events (Visual Basic).
Requirements
Namespace: Microsoft.VisualBasic.ApplicationServices
Class: WindowsFormsApplicationBase
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
Availability by Project Type
Project type | Available |
---|---|
Windows Application |
Yes |
Class Library |
No |
Console Application |
No |
Windows Control Library |
No |
Web Control Library |
No |
Windows Service |
No |
Web Site |
No |
Permissions
No permissions are required.
See Also
Reference
My.Application Object
My.Application.MinimumSplashScreenDisplayTime Property
System.Windows.Forms.Form
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.SplashScreen