Link to home
Start Free TrialLog in
Avatar of bmccleary
bmccleary

asked on

VB.NET - Creating a splash screen

I have a project that I would like to have a splash screen display while loading.  The main form is called frmMain and the splash screen is called frmSplashScreen.  I have the following code, and it works somewhat, but I don't think it's the proper method to use and it doesn't seem to fully close when I close the main form.  My project's startup form is frmSplashScreen...  what should I do to make a proper splash screen?

  Private Sub frmSplashScreen_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
    Dim i As Double
    For i = 0 To 1 Step 0.025
      Me.Opacity = i
      Me.Refresh()
    Next

    ' Also... how can I pause here for 5 seconds?
   
    Dim MainForm As New frmMain
    MainForm.Show()
    Me.Hide()
  End Sub
SOLUTION
Avatar of testn
testn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of testn
testn

SOLUTION
Avatar of Howard Cantrell
Howard Cantrell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi malharone,

I like your idea interesting concept.
Avatar of bmccleary

ASKER

Thanks everyone... all those options were great!
     Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
     
 Dim i As Integer
        For i = 1 To 200
            Me.Opacity = i / 200
            System.Windows.Forms.Application.DoEvents()
        Next
   
End Sub
Maybe it is just me but does the progressbar really have any meaning or is this just for show?  If just for show is there anyway to apply it in a way that is has meaning or represents what is happening in the background?

Tim
Ive set the following properties for making my form as splash screen
These are
1)FormBorderStyle=None
2)StartScreen=CenterScreen
3)ControlBox=None
4)TopMost=True
Then I pust PictureBox and add a picture and the add few labels and use registry function to fill them..and make it startup page and then I added Windows Timer Control
on and set enabled = true default
then
 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
 Me.Hide()
        'Add code to show second form
        Timer1.Enabled = False
    End Sub