First of all, you should carefully read how the timer works, because now, judging by the code, you do not have this understanding.
The code that should output "Please wait" before starting the timer, you have for some reason in timer1_Tick() , and the code that should be in a tick is located in button1_Click() . Delay is not needed at all, since you already have a timer!
The scheme should be as follows:
- add the first entry
- print "Please wait"
- we start the timer
- in each tick we increase the progress bar value
- as soon as we’ve finished counting, stop the timer, add the second entry, and remove "Please wait"
It should be like this:
private void button1_Click(object sender, EventArgs e) { listBox1.Items.Add("First Item"); toolStripStatusLabel1.Text = "Please, wait..."; progressBar1.Value = 0; // за 5 секунд тикнет 100 раз, этого достаточно, можно даже и реже timer1.Interval = 50; timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { toolStripProgressBar1.Value++; // подразумевается, что максимум равен 100 // в любом случае интервал таймера * максимум прогресс бара // должен давать желаемую задержку в мс if (toolStripProgressBar1.Value == 100) { timer1.Stop(); toolStripStatusLabel1.Text = string.Empty; listBox1.Items.Add("Second Item"); } }
Alternatively, you can have two timers to get rid of the unobvious dependency "timer interval * maximum progress bar == delay in ms." The first timer ticks every 100 ms and increases the progress bar. The second timer is activated after 5 seconds, stops both timers and adds / updates records.