title: Threading & Cross Threading in C#.NET, How do I change ComboBox Data from another Thread?
body: <p>I need to use threading in my app, but I don't know how to perform a cross threading operation.  </p>
  
  <p>I want to be able to change the text of a form object (in this case a Combo Box), from another thread, I get the error:</p>
  
  <pre><code>Cross-thread operation not valid: Control 'titlescomboBox' accessed from a thread other than the thread it was created on.
  </code></pre>
  
  <p>I don't really understand how to use the invoke and begin invoke functions, So im really looking for a dead simple example and explanation for this so I can learn around that.</p>
  
  <p>Also any beginner tutorials would be great, I found a few, but their all so different, I don't understand exactly what I need to do to perform cross threading ops.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>    // Main Thread. On click of the refresh button
      private void refreshButton_Click(object sender, EventArgs e)
      {
          titlescomboBox.Items.Clear();
          Thread t1 = new Thread(updateCombo);
          t1.Start();
      }
  
      // This function updates the combo box with the rssData
      private void updateCombo()
      {
          rssData = getRssData(channelTextBox.Text);       // Getting the Data
          for (int i = 0; i &lt; rssData.GetLength(0); i++)   // Output it
          {
  
              if (rssData[i, 0] != null)
              {
  
                // Cross-thread operation not valid: Control 'titlescomboBox' 
                // accessed from a thread other than the thread it was created on.
  
                titlescomboBox.Items.Add(rssData[i, 0]);   // Here I get an Error
  
              }
              titlescomboBox.SelectedIndex = 0;
          }
      }
  </code></pre>