Creating a Splash Screen in VB.NET Windows Forms: A Beginner-Friendly Guide
A splash screen is a brief introductory screen that appears when you launch an application. It typically shows branding elements like a logo, app name, version, or a loading bar. In this guide, you'll learn how to create a splash screen in VB.NET using Windows Forms.
Why Use a Splash Screen?
Here are a few reasons:
-
Enhances User Experience
-
Shows application is loading (especially if startup takes time)
-
Displays branding and professionalism
-
Performs background tasks before the main form opens
Requirements:
-
Visual Studio (any edition supporting VB.NET)
-
.NET Framework or .NET Core
-
Basic understanding of WinForms
Step-by-Step Guide
Step 1: Create Two Forms
-
SplashScreen.vb: The splash screen form
-
Form1.vb: The form you want to open after splash screen
Step 2: Design the SplashScreen
Add the following controls:
-
Label: App name or version or company name
-
ProgressBar: Shows loading progress
-
Timer: Drives the loading animation
Set Timer.Interval = 100 (0.1 sec)
Step 3: Add Code to SplashScreen
Public Class SplashScreen
Private Sub SplashScreen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ProgressBar1.Value = 0
Timer1.Start()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 5
If ProgressBar1.Value >= 100 Then
Timer1.Stop()
Me.Hide()
MainForm.Show()
End If
End Sub
End Class
Step 4: Set SplashScreen as Startup Form
-
Open
Project -
Go to Application tab
-
Set Startup Form to
SplashScreen
Step 5: Customize Appearance
-
StartPosition = CenterScreen -
FormBorderStyle = None -
TopMost = True -
Add logo or images as need
Comments
Post a Comment