title: Refreshing dataGridView's DataSource from another form
body: <p>I made an application that displays some data in a DataGridView control. The data is stored in an SQL database. Since there are a lot of parameters for this specific display, I created another (child) form in the same project that helps the user to add or alternate the data in the database. Both adding and alternating functions work fine, but the data in the DataGridView stays unchanged. I know how to refresh the DataGridView's DataSource, but I don't know how to trigger that function form another form. </p>
  
  <p>I use this function to refresh the DataGridView's DataSource:</p>
  
  <pre><code>private void RefreshMyDGV()
  {
      command.CommandText = "SELECT * FROM MyDataBase";
      SDA.SelectCommand = command;
      SDA.Fill(myDataTable);
      dataGridView1.DataSource = MyDataTable;
  }
  </code></pre>
  
  <p>I tried to change this function into a public static function so I would be able to access it from the other (child) form, but then the compiler throws errors "An object reference is required for the non-static field, method, or property".</p>
  
  <p>I also tried to define the DataGridView as public, and then access it from the other form:</p>
  
  <pre><code>((Form1)fr1).dataGridView1.DataSource = myDataTable;
  </code></pre>
  
  <p>But that didn't work either.</p>
  
  <p>Please suggest a way to do this.
  Thanks.</p>