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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…