I have many threads running in my C# application and each of those threads accesses a TextBox
to log its events. When I set the CheckForIllegalCrossThreadCalls property to false
, I am able to block many cross-threading errors:
System.InvalidOperationException: Cross-thread operation not valid: Control 'myTextBox'
accessed from a thread other than the thread it was created on.
What is the best solution for this problem? Using delegates or disabling CheckForIllegalCrossThreadCalls
as I have tried? Many articles say that disabling CheckForIllegalCrossThreadCalls
is not a good programming practice.