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.
More Related Contents:
- Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on
- How to stop BackgroundWorker on Form’s Closing event?
- Automating the InvokeRequired code pattern
- WinForm Application UI Hangs during Long-Running Operation
- Question about terminating a thread cleanly in .NET
- How do I update the GUI from another thread?
- Cross-thread operation not valid [duplicate]
- Writing to a TextBox from another thread? [duplicate]
- How to kill a thread instantly in C#?
- How to invoke a UI method from another thread
- Force GUI update from UI Thread
- How to update textbox on GUI from another thread [duplicate]
- Run two winform windows simultaneously
- Running a method in BackGroundWorker and Showing ProgressBar
- Run multiple UI Threads
- Spawn a new thread to open a new window and close it from a different thread
- COM object that has been separated from its underlying RCW cannot be used
- Getting Cross-thread operation not valid [duplicate]
- Show Loading animation during loading data in other thread
- C# Windows Forms Application – Updating GUI from another thread AND class?
- Cross-thread Winforms control editing [duplicate]
- Solve a cross-threading Exception in WinForms
- How to access a WinForms control from another thread i.e. synchronize with the GUI thread?
- Multiple UI Threads – Winforms
- How to exit all running threads?
- Avoiding the woes of Invoke/BeginInvoke in cross-thread WinForm event handling?
- Populating a DataGridView with Text and ProgressBars
- Update label from another thread [duplicate]
- Is it good idea to use “Control.CheckForIllegalCrossThreadCalls = false” [duplicate]
- Draw on a form by a separate thread