While it may appear to work most of the time, it is sure to fail every now and then.
If you need to access/modify the UI control from another thread, use Control.Invoke.
More Related Contents:
- Automating the InvokeRequired code pattern
- WinForm Application UI Hangs during Long-Running Operation
- Invoke(Delegate)
- Question about terminating a thread cleanly in .NET
- How do I update the GUI from another thread?
- Cross-thread operation not valid [duplicate]
- How to update GUI with backgroundworker?
- C#: Difference between ‘ += anEvent’ and ‘ += new EventHandler(anEvent)’
- Writing to a TextBox from another thread? [duplicate]
- Passing variable between winforms
- Multi-threaded splash screen in C#?
- Is EndInvoke() optional, sort-of optional, or definitely not optional?
- How to update textbox on GUI from another thread [duplicate]
- How to pass an event to a method?
- 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
- Getting Cross-thread operation not valid [duplicate]
- Solve a cross-threading Exception in WinForms
- How to access a WinForms control from another thread i.e. synchronize with the GUI thread?
- What’s the difference between QueueUserWorkItem() and BeginInvoke(), for performing an asynchronous activity with no return types needed
- Multiple UI Threads – Winforms
- How to exit all running threads?
- Avoiding the woes of Invoke/BeginInvoke in cross-thread WinForm event handling?
- Return a value from an Event — is there a Good Practice for this?
- InvalidOperationException – object is currently in use elsewhere – red cross
- Does Func.BeginInvoke use the ThreadPool?
- Update label from another thread [duplicate]
- Why does the inner exception reach the ThreadException handler and not the actual thrown exception?
- Detect when a form has been closed c#