title: How to get data from a thread to the UI in C# (How to use backgroundWorker)
body: <p>In my application, I am using a Data Grid View. The data to be filled in the data grid view are in another thread.</p>
  
  <p>How can I get data from another thread to the Data Grid View? How can I use background worker for this? (Please find the sample code below)</p>
  
  <p>Please help. I am new to c#.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  
  namespace ex1
  {
  public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
  
          dataGridView1.Columns.Add("1", "Sno"); 
          dataGridView1.Columns.Add("2", "Time");
          dataGridView1.Columns.Add("3", "Name");
      }
  public void button2_Click(object sender, EventArgs e)
  {
  
      // Get data from MyThread and add new row to dataGridView1.
  
      //Like,
      dataGridView1.Rows.Add(sno,time,name); // strings from MyThread
  
  }
  
  #region EVENT THTEAD (RX)
      public void MyThread()
      {
          // Each time button2 press, took data from here and add that to dataGridView1 as a new row.
  
          String sno= "some value";
          String time="some value";
          String name="some value";
  
       }
      #endregion
  }
  }
  </code></pre>