Results 1 to 8 of 8

Thread: [RESOLVED] ToolstripProgressBar1 loads to full when..[HELP]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    96

    Resolved [RESOLVED] ToolstripProgressBar1 loads to full when..[HELP]

    I have a button and when i click it, it shows a msgbox. I want it so that when i click the button, the progress bar loads to full for about 5 seconds or so, and then the msgbox is shown. This is my code for the button to show msgbox. I also want the statuslabel that goes with the progress bar to say "Checking.." when it is in the process and then say "Done" when the message box appear.

    Code:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            MsgBox("You clicked me!")
        End Sub
    Thanks!

  2. #2
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: ToolstripProgressBar1 loads to full when..[HELP]

    So what's the problem?

    You want a timer control that ticks maybe every half second and increments the progress bar's progress property to the appropriate percentage (if min is 0 and max is 100 then that would be adding 10 to the value every tick if it's interval is set to 500 milliseconds). Also set the statuslabel every time the timer ticks.

    The when the progress bar's value is 100 then disable the timer and show your message box.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    96

    Re: ToolstripProgressBar1 loads to full when..[HELP]

    Quote Originally Posted by keystone_paul View Post
    So what's the problem?

    You want a timer control that ticks maybe every half second and increments the progress bar's progress property to the appropriate percentage (if min is 0 and max is 100 then that would be adding 10 to the value every tick if it's interval is set to 500 milliseconds). Also set the statuslabel every time the timer ticks.

    The when the progress bar's value is 100 then disable the timer and show your message box.
    Can you give me a example of the code? Thanks

  4. #4
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: ToolstripProgressBar1 loads to full when..[HELP]

    An example... sure :

    Code:
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    
            ProgressBar1.Value += 10
            ProgressBar1.Refresh()
            Label1.Text = ProgressBar1.Value & "%"
            If ProgressBar1.Value = 100 Then
                Timer1.Stop()
                MessageBox.Show("Reached the end", "My Message Box", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End If
    
        End Sub

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    96

    Re: ToolstripProgressBar1 loads to full when..[HELP]

    Quote Originally Posted by keystone_paul View Post
    An example... sure :

    Code:
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    
            ProgressBar1.Value += 10
            ProgressBar1.Refresh()
            Label1.Text = ProgressBar1.Value & "%"
            If ProgressBar1.Value = 100 Then
                Timer1.Stop()
                MessageBox.Show("Reached the end", "My Message Box", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End If
    
        End Sub
    How can i use this timer for a button, like if i click a button this goes into effect?

  6. #6

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    96

    Re: ToolstripProgressBar1 loads to full when..[HELP]

    Never mind i got it to work. Thanks so much sir!
    this is the code
    Code:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Timer1.Start()
        End Sub

  7. #7
    PowerPoster keystone_paul's Avatar
    Join Date
    Nov 2008
    Location
    UK
    Posts
    3,327

    Re: ToolstripProgressBar1 loads to full when..[HELP]

    No problem - don't forget to mark the thread as resolved using the Thread Tools menu if you have found your answer.

    Cheers.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Posts
    96

    Re: ToolstripProgressBar1 loads to full when..[HELP]

    Quote Originally Posted by keystone_paul View Post
    No problem - don't forget to mark the thread as resolved using the Thread Tools menu if you have found your answer.

    Cheers.
    Thank you and yes i did !

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