Resolved how to keep the form 1 property after Splash Screen

Tamiryosef

Active member
Joined
May 2, 2022
Messages
36
Programming Experience
1-3
Hello to all

i build a splash screen that have progress bar and after the progress bar end i like to open the form 1

i code that , it open the form 1 but all the component is not in proper scales and out form their locations

if i set the startup of the app form form1 everting is good,but if i chance the startup to my splash screen is mashup

bat:
    Private Sub Timerbar_Tick(sender As Object, e As EventArgs) Handles Timerbar.Tick
        Timerbar.Start()

        ProgressBar1.Increment(2)
        If ProgressBar1.Value = 100 Then
          
            Timerbar.Stop()
            Me.Hide()

            Form1.Show()


        End If
    End Sub
 
Solution
Then you should do what I already told you to do. Neither form needs to know about the other so neither form needs to do anything to the other. Just add the two forms to the project and select one as the startup form and the other as the splash screen. That's it, that's all. No code required.

Note that, using the inbuilt functionality, the splash screen will remain visible for a minimum of 2 seconds and as long as the startup form is still loading. If your startup form loads quickly but you want the splash screen to remain visible longer than 2 seconds, you can learn how to do that here.

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,728
Location
Sydney, Australia
Programming Experience
10+
You are going about this all wrong. VB has splash screen functionality built in. Make Form1 the startup form, as it was by default, then select the other form as the splash screen. Problem solved.

Also, why are you calling Start on the Timer in its own Tick event handler? How could it raise that event if it hadn't already been started?
 

Tamiryosef

Active member
Joined
May 2, 2022
Messages
36
Programming Experience
1-3
i put this code at form 1 ,it open the splash screen for 5000 and then show back form 1
but the problem it not show the text i enter at splash screen only the background
and after 5000ms it open the form 1

splash:
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Me.Visible = False
        SplashScreen1.Show()
        System.Threading.Thread.Sleep(5000)
        SplashScreen1.Close()

        Me.Visible = True
    End Sub
End Class
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,728
Location
Sydney, Australia
Programming Experience
10+
Then you should do what I already told you to do. Neither form needs to know about the other so neither form needs to do anything to the other. Just add the two forms to the project and select one as the startup form and the other as the splash screen. That's it, that's all. No code required.

Note that, using the inbuilt functionality, the splash screen will remain visible for a minimum of 2 seconds and as long as the startup form is still loading. If your startup form loads quickly but you want the splash screen to remain visible longer than 2 seconds, you can learn how to do that here.
 
Solution
Top Bottom