Cross-thread operation not valid in C#
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/142003/cross-thread-operation-not-valid-control-accessed-from-a-thread-other-than-the-t">Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on.</a>  </p>
</blockquote>



<p>Greeting,
I'm trying to update button status from a thread and I'm getting this error:</p>

<p>"Cross-thread operation not valid: Control 'btn1' accessed from a thread other than the thread it was created on."</p>

<p>please advice how to fix this problem.</p>

<p>here is my code:</p>

<pre><code> if (strMyPlayer == "Player One")
 {
      if (srReceiver.ReadLine() == "Player One says: btn1")
      {
           btn1.Text = "O";
           btn1.Enabled = false; 
      }
 }
 else
 {
      if (srReceiver.ReadLine() == "btn1")
      {
           btn1.Text = "X";
           btn1.Enabled = false;
      }     
 }
</code></pre>
