Quantcast
Viewing all articles
Browse latest Browse all 27034

VS 2010 [RESOLVED] Timer Syncing issues

I've got a progressbar that's going in reverse (starting at the max and reducing by 1 each time, giving the shrinking effect)
I'm using two timers, the first that handles all of the timed action, and the second to shrink the progress. The first resets the progressbar each tick. The progressbar's maximum and value are set to timer1's interval, and each millisecond 1 is removed from the value (done by timer2)
however before the progressbar gets to the end, it resets from timer1's tick. I'm going in second intervals, so the progressbar's maximum is 1000 (1000 ms for a second) and it gets reduced by 1 each tick

Code:

   
    Private Sub Timer2_Tick(sender As System.Object, e As System.EventArgs) Handles Timer2.Tick
        GhostProgressbar1.Value = GhostProgressbar1.Value - 1
        lblTaken.Text = GhostProgressbar1.Value & "/" & Timer1.Interval 'gets down to 930/1000 before resetting
    End Sub
   
   
   
    Dim r As New Random
    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        GhostProgressbar1.Value = Timer1.Interval
        GhostTheme1.Text = r.Next 'the title changes when the progressbar resets so I believe it has something to do with Timer1
    End Sub


Viewing all articles
Browse latest Browse all 27034

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>