7
Answers

Why isnt my progressbar working correctly ( C# )

Ask a question
Caleb Dunn

Caleb Dunn

12y
2.9k
1
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)