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:

SplashScreen1.Show()
Form2.Show()

Recommended Answers

All 9 Replies

Why dont you just make use of the splash screen setting in the My Application > Application menu?

8ae345254c4c9bb69e810b0ff6e79a04

commented: Good advice! +14

Did you add the PictureBox to the controlscollection of the Form?

I ag with Begginnerdev, you could just change the startup form to your splashscreen, and use a timer to close the splash screen and open your other form after a certain amount of time.

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

Form2.Show()

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
    Try
        Timer1.Start()
    Catch ex As Exception
        MsgBox(ex.ToString)
    End Try
End Sub

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
End Sub

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).

commented: Exactly! +8

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.

The solution with ShowDialog and a BackGroundWorker was a success. Many thanks guys! :)

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.

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.