title: C#, Event Handlers and Threading
body: <p>I'm writing a little chat app, and I have this event handler:</p>
  
  <pre><code>void o_Typing(object sender, EventArgs e)
  {
      MessageBox.Show("Fired!");
      this.Text = "Fired!";
  }
  </code></pre>
  
  <p><code>o_Typing</code> is a method in a class derived from <code>TabPage</code>. Basically, I want each conversation to have it's own tab.</p>
  
  <p>The event handlers are fired by my Chat object, which is running in another thread. I have 1 thread for UI, and another thread for each Chat conversation (to keep polling the server for new data)</p>
  
  <p>When the event is fired, the <code>MessageBox</code> pops up, but the Tab caption doesn't change. After the event has fired once, it never fires again, leading me to believe that the event is being called in the worker thread, although it is defined in the UI thread.</p>
  
  <p>How can I get my events to be called from the worker thread, and use <code>Invoke()</code> to get them to execute on the UI thread?</p>