
Originally Posted by
NextGen1
Your code tells the story.
It reads. (literal logic)
Display MsgBox then Reset Progressbar.
Code:
If ProgressBar1.Value < ProgressBar1.Maximum Then
ProgressBar1.Value = ProgressBar1.Value + 50
End If
If Progressbar1.value is 51 when the above code fires, you'll just end up throwing an error.
Fact is, when using progressbars (in this manner and in your manner) the likely hood of firing it 1 below target or above target is very likely.
Side note, this is obviously a faux progressbar, why not just get rid of it, it doesn't have any real purpose then "aesthetics" and really it's lacking there as well. If you were actually incrementing the progress bar based on loaded content, then there would be a easy solution.
But, if you want the progressbar to continue to the end, don't set the value to 0 , naturally it will restart.
It would be better to see your entire code though, most of us here would need to see what your doing in context to truly help you get a proper answer.
OK
i understood that you need the code:
Public Class Form1
Private members
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
If CheckBox3.Checked Then
MsgBox("Sorry you could not take so much. We will repair this mistake.", MsgBoxStyle.Critical, "Error")
End If
If CheckBox1.Checked = True And CheckBox2.Checked = True Then
MsgBox("Sorry, but you ticked 2 and that doesn't work!", MsgBoxStyle.Critical, "Mis take")
End If
If CheckBox1.Checked = False Then
If CheckBox2.Checked = False Then
If CheckBox3.Checked = False Then
MsgBox("You must tick something", MsgBoxStyle.Information, "Info")
End If
End If
End If
End Sub
Private Sub Button1_SecondClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.MouseClick
ProgressBar1.Value = "0"
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Increment(0.9)
If ProgressBar1.Value = ProgressBar1.Maximum Then
ProgressBar1.Value = "0"
Timer1.Stop()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
ProgressBar1.Value = "0"
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
End Class
I hope now you can help me
