Splash screen

brechtjah

Member
Joined
Mar 23, 2008
Messages
23
Programming Experience
Beginner
Hi,
since I want a Splashscreen for my program I want my startform to immediatly close (hide) after loading... And then show the Splash ofcourse, I've read however (and already tested) that this is not possible. You can't hide a form at load.
Then what can I use to work around this?

Thanks
 
Go to project properties and select your splash form in "splash screen" setting, then it will display before main form loads.
 
Okay that worked to set that but now I'm getting an error that involves this piece of code:
VB.NET:
    Private Sub lblTijdTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblTijdTimer.Tick
        'Tijd weergeven in label
        strTijd = TimeOfDay
        lblTijd.Text = strTijd
    End Sub

The error is something in the lines of (translation might not be so good): from the side of another thread there was gained access to the element lblTijd (the label), other than the thread where the object is made.
Don't get this quite...

Thanks for your help :)
 
Since the built-in splash functionality runs it's own thread you can use the System.Timers.Timer and synchronize the event like this:
VB.NET:
Private WithEvents t As New System.Timers.Timer

Private Sub mysplash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    t.Interval = 100
    t.SynchronizingObject = Me
    t.Start()
End Sub

Private Sub t_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles t.Elapsed
    Me.Label1.Text = Date.Now.ToLongTimeString
End Sub
 
Back
Top