title: "BindingSource cannot be its own data source" - error when trying to reset the binding source from a method in another class
body: <p>We are binding a <code>DataGridview</code> using <code>BindingSource</code>. So in the main thread we have given like this.</p>
  
  <pre><code>            class1BindingSource = new BindingSource();
              class1BindingSource.DataSource = class1List;  
              this.dataGridView1.DataSource = class1BindingSource;
  </code></pre>
  
  <p>After that i have a placed a background worker in the form and is triggering in a button click.</p>
  
  <p>i.e. in the button click</p>
  
  <pre><code>this.backgroundWorker1.RunWorkerAsync()
  </code></pre>
  
  <p>In the <code>BackgroundWorker</code> <code>DoWork Event</code> i am trying to update the <code>BindingSource</code> and there by trying to update the <code>DataGridview</code>.</p>
  
  <p>So the <code>BindingSource</code> reset is done in a method in another class.</p>
  
  <p><em><code>DoWork Event</code></em></p>
  
  <pre><code>Class2 cl2 = new Class2();
  cl2.UpdateBindingSource(class1BindingSource);
  </code></pre>
  
  <p><em><code>UpdateBindingSource Method</code></em></p>
  
  <pre><code>public void UpdateBindingSource(BindingSource bs)
          {
              Class1 c1 = bs.Current as Class1;    
              for (int i = 0; i &lt; 1000; i++)
              {
                  lock (bs.SyncRoot)
                  {
                      c1.MyProperty1 = i;
                      bs.ResetItem(0);
                  }
              }
          }
  </code></pre>
  
  <p>Now i am getting an exception like <em><code>BindingSource</code> cannot be its own data source. Do not set the <code>DataSource</code> and <code>DataMember</code> properties to values that refer back to <code>BindingSource</code>.</em></p>
  
  <p>If i am doing this in my <code>DoWork Event</code> then i can reset the item in the control thread itself using <code>BeginInvoke method</code>.</p>
  
  <p>But actually i am trying to simulate our application scenario. So i want to solve this in this format.</p>
  
  <p>Can any one help me on this.</p>