# Question : Progress Bar Bound to Timer

## Answer : Progress Bar Bound to Timer

##### It's not very wise to compete with Idle_Mind but I just want to propose very simple straightforward solutionOf course, there are the following controls on a form:           this.button1            this.progressBar1            this.progressBar1            this.timer1.            this.label1 ```1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: ``` ``` public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.button1.Visible = false; this.progressBar1.Minimum = 0; this.progressBar1.Maximum = 200; this.timer1.Interval = 100;// 1 second this.label1.Text = ""; } private void button1_Click_1(object sender, EventArgs e) { this.Close(); } private void Form1_Shown(object sender, EventArgs e) { this.timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { // increase progressbar if (this.progressBar1.Value < this.progressBar1.Maximum) { this.progressBar1.Value += 1; } // 5 seconds elapsed (25 ticks on a progre: if (this.progressBar1.Value == 50) { this.label1.Text = "5 seconds"; } else if (this.progressBar1.Value == 150) { this.label1.Text = "15 seconds"; } else if (this.progressBar1.Value == this.progressBar1.Maximum) { this.timer1.Stop(); this.label1.Text = "timer stopped"; this.button1.Visible = true; } } }```
 Random Solutions