|
-
Dec 9th, 2021, 02:43 AM
#1
Thread Starter
Lively Member
[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
Last edited by roy88; Dec 9th, 2021 at 02:48 AM.
-
Dec 9th, 2021, 02:45 AM
#2
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.
-
Dec 9th, 2021, 02:53 AM
#3
Thread Starter
Lively Member
Re: I want to automatically after the progreesbar form appears then the main form app
 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
-
Dec 9th, 2021, 03:01 AM
#4
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.
-
Dec 9th, 2021, 03:17 AM
#5
Thread Starter
Lively Member
Re: I want to automatically after the progreesbar form appears then the main form app
 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
-
Dec 9th, 2021, 04:01 AM
#6
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.
-
Dec 9th, 2021, 04:09 AM
#7
Thread Starter
Lively Member
Re: I want to automatically after the progreesbar form appears then the main form app
 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
Last edited by roy88; Dec 9th, 2021 at 04:17 AM.
-
Dec 9th, 2021, 04:12 AM
#8
Lively Member
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.
-
Dec 9th, 2021, 04:23 AM
#9
Thread Starter
Lively Member
Re: I want to automatically after the progreesbar form appears then the main form app
 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?
-
Dec 9th, 2021, 04:36 AM
#10
Thread Starter
Lively Member
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
-
Dec 9th, 2021, 04:44 AM
#11
Lively Member
Re: I want to automatically after the progreesbar form appears then the main form app
 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.
-
Dec 9th, 2021, 04:55 AM
#12
Thread Starter
Lively Member
Re: I want to automatically after the progreesbar form appears then the main form app
 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
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|