|
-
September 9th, 2011, 12:38 PM
#3
Re: Im new, need a little help :O)
Greetings,
First, set your progress bar properties (min,max,step) on the control in design view, or set them during your form initialization (load)... no need to set them with each tick of the timer.
Second, after you step your progress bar with each timer tick, you need to check to see if you have reached the progress bar's maximum value, and if you have, you simply stop your timer and set your progress bar value to zero (or it's min value).
Something like this...
Code:
(on form load)
{
progressBar1.Minimum = 0;
progressBar1.Maximum = 300;
progressBar1.Step = 50;
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
button1.Enabled = false;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (progressBar.Value == progressBar.Maximum)
{
timer1.Stop();
progressBar1.Value = 0;
button1.Enabled = true;
}
else
progressBar1.PerformStep();
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|