Results 1 to 12 of 12

Thread: [RESOLVED] I want to automatically after the progreesbar form appears then the main form appears

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2021
    Posts
    91

    Resolved [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.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2021
    Posts
    91

    Re: I want to automatically after the progreesbar form appears then the main form app

    Quote Originally Posted by jmcilhinney View Post
    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

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2021
    Posts
    91

    Re: I want to automatically after the progreesbar form appears then the main form app

    Quote Originally Posted by jmcilhinney View Post
    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

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 2021
    Posts
    91

    Re: I want to automatically after the progreesbar form appears then the main form app

    Quote Originally Posted by jmcilhinney View Post
    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.

  8. #8
    Lively Member
    Join Date
    Aug 2014
    Posts
    65

    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.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Aug 2021
    Posts
    91

    Re: I want to automatically after the progreesbar form appears then the main form app

    Quote Originally Posted by THIEF15 View Post
    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?

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Aug 2021
    Posts
    91

    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

  11. #11
    Lively Member
    Join Date
    Aug 2014
    Posts
    65

    Re: I want to automatically after the progreesbar form appears then the main form app

    Quote Originally Posted by roy88 View Post
    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.

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Aug 2021
    Posts
    91

    Re: I want to automatically after the progreesbar form appears then the main form app

    Quote Originally Posted by THIEF15 View Post
    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
  •  



Click Here to Expand Forum to Full Width