P PharCyDeD Active Member Licensed User Longtime User Feb 21, 2012 #1 I want to use a progress bar that ticks down from 100 by -1 a second. I have this code: Globals: Code: Dim pbTimeLeft As ProgressBar Activity_Create: Code: pbTimeLeft.Initialize(pbTimeLeft) pbTimeLeft.Progress = 100 Timer: Code: Sub Timer1_Tick countDown = countDown - 1 lblCountDown.Text = countDown pbTimeLeft.Progress = pbTimeLeft.Progress - 1 If countDown=0 Then Timer1.Enabled= False End If End Sub It is not working though? It is purely for visual purposes as the real count is kept by the countDown variable, but I still would like to use it.
I want to use a progress bar that ticks down from 100 by -1 a second. I have this code: Globals: Code: Dim pbTimeLeft As ProgressBar Activity_Create: Code: pbTimeLeft.Initialize(pbTimeLeft) pbTimeLeft.Progress = 100 Timer: Code: Sub Timer1_Tick countDown = countDown - 1 lblCountDown.Text = countDown pbTimeLeft.Progress = pbTimeLeft.Progress - 1 If countDown=0 Then Timer1.Enabled= False End If End Sub It is not working though? It is purely for visual purposes as the real count is kept by the countDown variable, but I still would like to use it.
Ricky D Well-Known Member Licensed User Longtime User Feb 21, 2012 #2 I haven't tried this but maybe put a DoEvents in the timer event? regards, Ricky Upvote 0
P PharCyDeD Active Member Licensed User Longtime User Feb 21, 2012 #3 I am not sure what I am doing wrong I did add DoEvents to the timer, but that didn't work either. Am I creating the progressbar correctly? Because no matter what I set .progress to it does not reflect the progress in the app. Upvote 0
I am not sure what I am doing wrong I did add DoEvents to the timer, but that didn't work either. Am I creating the progressbar correctly? Because no matter what I set .progress to it does not reflect the progress in the app.
NJDude Expert Licensed User Longtime User Feb 21, 2012 #4 Take a look at the attached sample, is that what you're looking for?. Attachments TimerSample.zip TimerSample.zip 6.7 KB · Views: 943 Upvote 0
P PharCyDeD Active Member Licensed User Longtime User Feb 21, 2012 #5 Yes that is exactly what I am looking for, but I don't understand why it won't work within my project. I will do some digging on this to see what I can find. Upvote 0
Yes that is exactly what I am looking for, but I don't understand why it won't work within my project. I will do some digging on this to see what I can find.
P PharCyDeD Active Member Licensed User Longtime User Feb 21, 2012 #6 Well apparently you can't use ProgressBar1.Initialize in the activity create area when trying to do this. Not sure why, but when I removed that it worked fine. Thanks! Upvote 0
Well apparently you can't use ProgressBar1.Initialize in the activity create area when trying to do this. Not sure why, but when I removed that it worked fine. Thanks!