blah blah blah is here! blah blah » Close

up0down
link

i'm trying to have the timer to b connected with de progress bar. for example , after 10 sec de progress bar will move a bar?

last answered one year ago

2 answers

up0down
link

First set your timer's Interval property to 10000 and its Enabled property to true.

Now handle the timer's Tick event as follows (if you double click on the timer in the VS designer it will open up the handler for you):

private void timer1_Tick(object sender, EventArgs e)
{
progressBar1.PerformStep();

if (progressBar1.Value == progressBar1.Maximum)
{
timer1.Stop();
}
}

thank ^^

up0down
link

You could write something like this:

1) Add a timer object to your project
2) Set Interval property (the interval is in miliseconds)
3) Create a Tick Event ( you can double-click the timer to create it)
4) Add a progress bar object ; set Minimum and Maximum property with the values you desire;

private void myTimer_Tick(object sender, EventArgs e)
{
myTimer.Stop();

myProgressBar.Value += 1;

if(myProgressBar.Value == myProgressBar.Maximum)
myProgressBar.Value = myProgressBar.Minimum;

myTimer.Start();
}

thank^^

Feedback