Question

I am trying to continuously update my TextBox while the BackgroundWorker is running.

The code I am using freezes my application:

worker.RunWorkerAsync();

int i = 1;

while (worker.IsBusy)
{
   myTextBox.Text = i;
   i++;
   System.Threading.Thread.Sleep(2000);
}
Was it helpful?

Solution

As mentioned in comments you must use BackgroundWorker.ReportProgress Method to update your UI elements...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top