title: When am I allowed cross-thread access and when am I not?
body: <p>It seems that C# throws exceptions for cross-threading operations sometimes. For example, you can try running this sample code in a Windows Forms program:</p>
  
  <pre><code>    public Form1()
      {
          InitializeComponent();
          Thread setTextT = new Thread(TextSetter);
          setTextT.Start();
      }
  
      private void TextSetter()
      {
          //Thread.Sleep(4000);
          textBox1.Text = "Hello World";
      }
  </code></pre>
  
  <p>It doesn't throw any exceptions, everything seems to be working fine. Now, when you uncomment the Thread.Sleep line, it'll throw an exception for attempted cross-threading access.</p>
  
  <p>Why is this the case?</p>