How can i make a process bar go from like 10 to 90, 7 or 8 times?
Printable View
How can i make a process bar go from like 10 to 90, 7 or 8 times?
I honestly dont think this is what you want, but I gave it a try anyways :D
VB Code:
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick Static counter As Integer = 0 If counter = 0 Then pBar.Value = 10 End If If pBar.Value < 90 Then pBar.Value += 10 Else pBar.Value = 10 counter += 1 End If If counter = 7 Then Timer.Enabled = False counter = 0 End If End Sub
again, if that's not your answer, you have to exPLAIN your question more! :)
No... That wasn't what i was looking for/didn't work.
Okay. You have an empty process bar right?
Now i want it so when the app loads the proccess
bar will go from the value of 0 to the value 100
3 times.
|= 1 block in the process bar.
|-----------------------> ||||||||||
|-----------------------> ||||||||||
|-----------------------> ||||||||||
well the code that I gave you will move it from 10 to 90 for 7 times. You have to add a timer control and name it "Timer" and set the enabled property to true. Modify that and make it work for what you want.
I dont know if there is a good way to get rid of the stupid timer control though
Thanks i got it to work.
just wondering if the code I posted helped at all :rolleyes: :D
if not, could you post your code?:)
Wait a sec... its recognizing the code, but when i executed the program it didn't do anything. it just stayed on 10 (which is 2 bars)
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static counter As Integer = 0
If counter = 0 Then
ProgressBar1.Value = 10
End If
If ProgressBar1.Value < 90 Then
ProgressBar1.Value += 10
Else
ProgressBar1.Value = 10
counter += 1
End If
If counter = 7 Then
Timer1.Enabled = True
counter = 0
End If
End Sub
Thats what i have in. Tell me if its wrong
first, put your code in the [vbcode] and [/vbcode] tags when you post codes:)
umm why did you change
Timer.Enabled = False
to
Timer.Enabled = True
?
:confused:
What I ment was that the timer has to be started so that the code inside it would run. That's probably your problem. Add a command button to the form or put this in Form_Load
Timer.Enabled = True
OR you can just set the Enabled property to true when you are designing the form ( in the properties window)
So put Form_Load
Timer.Enabled = True
into a button?....
its not recognizing the Form_Load
sorry I'm confusing you :D
VB Code:
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick Static counter As Integer = 0 If pBar.Value < 90 Then pBar.Value += 10 Else pBar.Value = 10 counter += 1 End If If counter = 7 Then Timer.Enabled = False counter = 0 End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer.Enabled = True End Sub
try that
sorry I'm confusing you :D
VB Code:
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick Static counter As Integer = 0 If pBar.Value < 90 Then pBar.Value += 10 Else pBar.Value = 10 counter += 1 End If If counter = 7 Then Timer.Enabled = False counter = 0 End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer.Enabled = True End Sub
try that