i want my program to have a splash screen as the starting screen
but i need it to automatically count 10 minutes after it closes and form 1 loads. is it possible
should i use a timer or what?

Recommended Answers

All 3 Replies

>>should i use a timer or what?
I would use a Timer.

As for creating a Splash Screen, I would just create it from a basic Form and not from the built in one from vb.net.
You will have a lot more control over it.

Something simple, using 2 Forms.
Form1 is your Main Form and Form2 will be used as the SplashScreen Form.
Form1 code

Public Class Form1
    Private WithEvents tmr10MinuteTimer As New Timer With {.Interval = 1000, .Enabled = False} '// your Timer.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '// add this first.
        Form2.FormBorderStyle = Windows.Forms.FormBorderStyle.None '// no border.
        Form2.ShowInTaskbar = False '// do not show Icon of your Splash Screen in TaskBar.
        Form2.ShowDialog() '// load the Splash Screen.
        '// the code following that Form2.ShowDialog will not run until Form2 is closed.

        '//------ other code here if needed.

        '// start Timer after everything is loaded.
        tmr10MinuteTimer.Start()
    End Sub

    Private Sub tmr10MinuteTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmr10MinuteTimer.Tick
        Static iSeconds As Integer = 0
        If Not iSeconds = 600000 Then '// 10 minutes.
            iSeconds += 1 '// add to seconds.
        Else
            tmr10MinuteTimer.Enabled = False '// stop timer.
            MsgBox("10 minutes alert")
        End If
    End Sub
End Class

Form2 code

Public Class Form2
    Private WithEvents tmrSplashScreen As New Timer With {.Interval = 200, .Enabled = True} '// your Timer.

    Private Sub tmrSplashScreen_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrSplashScreen.Tick
        Static iDelay As Integer = 9
        If Not iDelay = 0 Then
            iDelay -= 1 '// subtract -1 until 0.
        Else
            tmrSplashScreen.Enabled = False '// disable Timer.
            Me.Close() '// .Close Form and continue running code in Form1_Load.
        End If
    End Sub
End Class
Member Avatar for Unhnd_Exception

What happens after 10 minutes? Do you win a prize? If so send me the link.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.