I'm having a nightmare here!
I'm calling 2 different forms, one like a loading screen and the other is the working form. The trick here is placing the 'SplashScreen1.Close()' at the end of Form2 and it will automatically close the loading screen when Fom2 finish.
But I could never get PictureBox inside SplashScreen1 to display nmw. Pls, help me!
Here's my code:
Thks for the answers, I've already had a different splashscreen for the loading screen and another for loading submenus (which I'm asking for help here).
In the previous version, I used to use timer and 'thread.sleep()' to solve the problems but now I want to make things a lil bit better. Is there a way?
You could place a timer on SplashScreen1, then do the following:
DIm ss1 As New SplashScreen1
ss1.ShowDialog() 'Will be a modal window and will not show Form2 Until it is closed.
ss1 = Nothing
Now, for the timer bit, in the SplashScreen_Load event place a timer.Start.
Private Sub Me_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Catch ex As Exception
Now place the closing code in the timer.Tick method.
Private iCount As Integer = 0 'Must store value of timer tick.
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
iCount += 1
If iCount = 5000 THen Me.Close
This will wait as long as you want, then close the form after the given span. (In this example it is 5 seconds)
Or in the form load of your splashscreen you could just have timer1.enabled = true. Then in the timer sub just have me.close and form2.show. To change the length that the splashscreen is up just change the interval (remember 1000 interval = 1 second).
Thks, Begginnerdev solution gave me a hint. Instead of using Show, I'm using ShowDialog and a BackGroundWorker now, but still couldn't find a way to solve it without a timer. Anyway, finally having a way, though.
Congradulations, on solving it. A possible alternate solution would be to put the two forms into thread calls. That would free them from the parent thread and the calling form could close while they kept going.