In this post I’m going to show you how to increment the value of a ProgressBar control. This can be done by assigning an integer number to the “Value” property.
Let’s do it with a “for” structure and a “Sleep” line to pause each iteration and see the value changing. Like this:
//Set the maximum value of the ProgressBar
progressBar1.Maximum = 10;
//Set the minimum value of the ProgressBar
progressBar1.Minimum = 0;
//Control the values of the “for” structure with the properties of the ProgressBar
for (int i = progressBar1.Minimum; i <= progressBar1.Maximum; i++)
{
//Assign the value to the ProgressBar
progressBar1.Value = i;
//Wait for 500 miliseconds (half second)
System.Threading.Thread.Sleep(500);
}
No hay comentarios.:
Publicar un comentario