[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!
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.
Re: ToolstripProgressBar1 loads to full when..[HELP]
Quote:
Originally Posted by
keystone_paul
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
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
Re: ToolstripProgressBar1 loads to full when..[HELP]
Quote:
Originally Posted by
keystone_paul
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?
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
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.
Re: ToolstripProgressBar1 loads to full when..[HELP]
Quote:
Originally Posted by
keystone_paul
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 !