Restarting progressibar count c#

Asked

Viewed 45 times

0

I have in my code a progressionBar, which is filled in 60 seconds, how do I so that when I arrive in 60 seconds he start counting again.

private void timer_progress_Tick(object sender, EventArgs e)
{
    pro_separacao.Increment(1);
} 
  • You want an endless bar Progress?

  • 1

    Thank you Linq for your attention, I don’t understand what you mean by infinite, but today in my code my progressbar fills with 60 seconds and to, I need that when it fills in 60 seconds it starts the 0 again and starts filling again and so on 60 in 60 seconds until the user leaves the screen.

  • Like I’m 60 seconds away from refreshing my windowsform.

1 answer

0

Declares an int variable outside the Timer.

then on your timer do it, very simple:

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

     if (segundos >= 60)
         segundos = 0;
 }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.