Page 151 - CSharp/C#
P. 151
}
else
{
MessageBox.Show("Task Complete!");
prgProgressBar.Value = 0;
}
}
// example method to perform a "long" running task.
private void CountToY()
{
int x = 0;
int maxProgress = 100;
prgProgressBar.Maximum = maxProgress;
while (x < maxProgress)
{
System.Threading.Thread.Sleep(50);
Invoke(new Action(() => { prgProgressBar.PerformStep(); }));
x += 1;
}
}
}
The result is the following...
Read BackgroundWorker online: https://riptutorial.com/csharp/topic/1588/backgroundworker
https://riptutorial.com/ 97

