[RESOLVED] I want to automatically after the progreesbar form appears then the main form appears
Dear All Master
Please Help me have 2 forms namely formwelcome (ProgressBar form) and form1 (main form). So I want after the formwelcome appears then automatically appear form1.
Code:
Imports WinFormAnimation
Public Class FormWelcome
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
CircularProgressBar1.Value += 1
CircularProgressBar1.Text = CircularProgressBar1.Value.ToString
If Me.Opacity < 1 Then
Me.Opacity += 0.05
End If
If CircularProgressBar1.Value = 100 Then
Timer1.Stop()
Timer2.Start()
End If
End Sub
Private Sub FormWelcome_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CircularProgressBar1.Value = 0
Me.Opacity = 0
Timer1.Start()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Me.Opacity -= 0.1
If Me.Opacity = 0 Then
Timer2.Stop()
Me.Close()
End If
End Sub
End Class
Thanks
roy88
Re: I want to automatically after the progreesbar form appears then the main form app
Sounds like you should be adding your welcome form as a splash screen and then specifying the minimum time for which it will be displayed.
Re: I want to automatically after the progreesbar form appears then the main form app
Quote:
Originally Posted by
jmcilhinney
Sounds like you should be adding your welcome form as a splash screen and then specifying the minimum time for which it will be displayed.
Dear jmcilhinney
but I've already created from windows form (formwelcome).whether it could be if I didn't create from splach screen.
Thanks
roy88
Re: I want to automatically after the progreesbar form appears then the main form app
You don't have to use the Splash Screen item template. Any form can be the splash screen for your application. You simply select the form you want to use in the project properties. It then gets displayed on a different thread for at least two seconds and until the startup form has been created. You can specify a longer minimum time in the appropriate overridden method if you want.
Re: I want to automatically after the progreesbar form appears then the main form app
Quote:
Originally Posted by
jmcilhinney
You don't have to use the Splash Screen item template. Any form can be the splash screen for your application. You simply select the form you want to use in the project properties. It then gets displayed on a different thread for at least two seconds and until the startup form has been created. You can specify a longer minimum time in the appropriate overridden method if you want.
This I've done I do using startup form in select formwelcome and I want is after appear formwelcome and then close and immediately appear form1
Re: I want to automatically after the progreesbar form appears then the main form app
So don't do that and do what I told you to do instead. The behaviour you're talking about is exactly what a splash screen is for, i.e. to be displayed before the main form. Do the obvious.
Re: I want to automatically after the progreesbar form appears then the main form app
Quote:
Originally Posted by
jmcilhinney
So don't do that and do what I told you to do instead. The behaviour you're talking about is exactly what a splash screen is for, i.e. to be displayed before the main form. Do the obvious.
can the solution with code so that first appear formwelcome then form1 (main form)?
displayed before the main form This is what I mean I didn't succeed so that appears only formwelcome (progressbar / splash screen) and form1 (main form) does not appear
Re: I want to automatically after the progreesbar form appears then the main form app
You can call form1 with form1.show and then close FormWelcome. In the properties you do need to set the shutdown mode to "When last form closes" otherwise the program will shut down when FormWelcome closes. Or you could also just hide FormWelcome and use FormWelcome.close to shutdown the program.
Re: I want to automatically after the progreesbar form appears then the main form app
Quote:
Originally Posted by
THIEF15
You can call form1 with form1.show and then close FormWelcome. In the properties you do need to set the shutdown mode to "When last form closes" otherwise the program will shut down when FormWelcome closes. Or you could also just hide FormWelcome and use FormWelcome.close to shutdown the program.
dear sir
Can you modify the code I posted?
Re: I want to automatically after the progreesbar form appears then the main form app
I added form.show in the code below formwelcome appears then appears form1 but the problem is form1 becomes close
Code:
Imports WinFormAnimation
Public Class FormWelcome
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
CircularProgressBar1.Value += 1
CircularProgressBar1.Text = CircularProgressBar1.Value.ToString
If Me.Opacity < 1 Then
Me.Opacity += 0.05
End If
If CircularProgressBar1.Value = 100 Then
Timer1.Stop()
Timer2.Start()
End If
End Sub
Private Sub FormWelcome_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CircularProgressBar1.Value = 0
Me.Opacity = 0
Timer1.Start()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Me.Opacity -= 0.1
If Me.Opacity = 0 Then
Timer2.Stop()
Me.Close()
End If
Form1.Show() >> "I added form.show"
End Sub
End Class
Re: I want to automatically after the progreesbar form appears then the main form app
Quote:
Originally Posted by
roy88
dear sir
Can you modify the code I posted?
First of all on the top you see File - Edit - View - Project. Click on "Project". Next click on "(name of your program) Properties". It opens a new window. Under the tab Application at the option "Shutdown mode" you need to set it too "When last form closes". This stops the program from closing when you close FormWelcome. Keep in mind that if you make a third form this 1 too needs to be closed.
Next just add the line on Timer2_Tick Form1.Show as shown below.
Code:
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Me.Opacity -= 0.1
If Me.Opacity = 0 Then
Timer2.Stop()
Form1.Show()
Me.Close()
End If
Hope this helps and that it is what you want.
Re: I want to automatically after the progreesbar form appears then the main form app
Quote:
Originally Posted by
THIEF15
First of all on the top you see File - Edit - View - Project. Click on "Project". Next click on "(name of your program) Properties". It opens a new window. Under the tab Application at the option "Shutdown mode" you need to set it too "When last form closes". This stops the program from closing when you close FormWelcome. Keep in mind that if you make a third form this 1 too needs to be closed.
Next just add the line on Timer2_Tick Form1.Show as shown below.
Code:
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Me.Opacity -= 0.1
If Me.Opacity = 0 Then
Timer2.Stop()
Form1.Show()
Me.Close()
End If
Hope this helps and that it is what you want.
Dear THIEF15
This is what I want and perfect. Thank you very much
thanks
roy88