Question: All:

I have created a Windows Form and a Button. In another Thread, I attempt to change the text of the button, and it crashes; but if I attempt to change the color of the button, it reliably succeeds. I thought that if you changed any Windows Form Control property, it would crash. Can somebody tell me what's going on? 

Here's my code that doesn't crash on the commented out line (but I thought it should):

```
Thread thr = new Thread(() => { 
    //myButton.ForeColor = Color.Purple; // this never causes a crash :=(
    myButton.Text = Color.Purple.ToString(); // this always causes a crash.
}); // 
thr.Start();

```

Any insights would be appreciated!

Michael

Answer: 
The Control.ForeColor property setter calls the Invalidate() method. Which is thread-safe in Windows. It merely sets the "this window needs to be repainted" status bit in the internal window state. Nothing actually happens with the window until later, when the Paint event runs. On the UI thread.

Winforms contains explicit code to suppress the exception.

Other examples are reading the Text property (not writing). And the documented ones, InvokeRequired, BeginInvoke, EndInvoke, Invoke and CreateGraphics. That's it.
[Documentation](http://msdn.microsoft.com/en-us/library/ms171728.aspx) says:

> 
> It is unsafe to call a control from a thread other than the one that created the control without using the Invoke method.
> 
> 
> 

It's unsafe to run across the street without looking first. You won't always get hit by a car, but your chances are pretty darned high.

> 
> This exception occurs reliably during debugging and, under some circumstances, at run time. You might see this exception when you debug applications that you wrote with the .NET Framework prior to the .NET Framework version 2.0. You are strongly advised to fix this problem when you see it, but you can disable it by setting the CheckForIllegalCrossThreadCalls property to false.
> 
> 
>