how to refresh the datagridview when new rows has been added
<p>hi i am a student of c# and working in winform i have a problem here to refresh the datagridview with new values i have a mainform in which i have a datagridview the data in the datagridview is filled up with the code</p>

<p>i have a second form which is invoked from a button on the main form as <code>showdialog</code>and the main form is running behind and there is one more button on the second form which is submit button. there are some controls on the second form from then the data is inserted into the database table, the table which is connected to the datagridview of main form so i want when the form second is opened and data is filled then when submit button is pressed so after <code>this.hide();</code> when the main form is visible then the submitted data should be in the datagridview
i have searched and found that changing the datasource would result in the datagridview to refresh with new data so i tried this</p>

<pre><code>MAINSOFTWARE ms = new MAINSOFTWARE();
                ms.dataGridView1.DataSource = null;
                ms.dataGridView1.DataSource = ms.bindingSource1;
                this.Hide();
</code></pre>

<p>but it is not refreshing the gridview with new submitted data so now is there any way to refresh?</p>
