Hello friend, the progress bar is showing full when the listBox1 items = 0 because of the following code:
progressBar1.Maximum = listBox1.Items.Count;
progressBar1.Value = 0;
Here you're setting
Maximum
property as 0 and the next line you're setting
Value
as 0 which means progress is 100% complete hence showing full.
Now try the following code changes:
private void timer1_Tick(object sender, EventArgs e)
{
if (listBox1.Items.Count > 0)
{
listBox1.Items.RemoveAt(0);
progressBar1.Increment(1);
groupBox1.Text = listBox1.Items.Count.ToString();
}
else
{
timer1.Enabled = false;
}
}
- DD