I have a long running for-each loop, and was wondering if there was a idiomatic way to add some visual user feedback so the user doesn\'t think the application crashed.
You could move the work to a BackgroundWorker and use the ReportProgress method.
for (i = 0; i < count; i++)
{
// do work
worker.ReportProgress((100 * i) / count);
}
private void MyWorker_ProgressChanged(object sender,
ProgressChangedEventArgs e)
{
taskProgressBar.Value = Math.Min(e.ProgressPercentage, 100);
}