Caleb Dunn

Caleb Dunn

  • NA
  • 59
  • 28.9k

Why isnt my progressbar working correctly ( C# )

Dec 30 2011 11:31 PM
I added a progress bar awhile ago and it seemed to be working fine, but then I started a new project and now the progress bar isnt doing anything when my button is clicked. I have a button and a timer so I dont know the reason as to why they arent working.

        private void button2_Click(object sender, EventArgs e)
        {
            timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            //MINIMUM IS ALREADY DEFINED AS 0
            //SET MAXIMUM IN THE PROPERTIES BAR
            progressBar1.Value += 3;
            if (progressBar1.Value == 99)
            {
                timer1.Stop();
                MessageBox.Show("Complete");
                progressBar1.Value = 0;
                this.Hide();
                Form2 newform = new Form2();
                newform.Show();
            }
        }

Answers (7)