Restarting progressbar count c #

0

I have in my code a progressBar, which is filled in 60 seconds, how do I do that when I get in 60 seconds it starts counting again.

private void timer_progress_Tick(object sender, EventArgs e)
{
    pro_separacao.Increment(1);
} 
    
asked by anonymous 28.11.2017 / 17:18

1 answer

0

Declare an int variable outside the Timer.

Then in your timer do this, very simple:

 private int segundos;
 private void timer1_Tick(object sender, EventArgs e)
 {
     segundos++;
     pro_separacao.Value = segundos;

     if (segundos >= 60)
         segundos = 0;
 }
    
28.11.2017 / 21:21