Accessing a form’s control from a separate thread

A Control can only be accessed within the thread that created it – the UI thread.

You would have to do something like:

Invoke(new Action(() =>
{
    progressBar1.Value = newValue;
}));

The invoke method then executes the given delegate, on the UI thread.

Leave a Comment