title: Load data to a datagrid using another form
body: <p>I have two forms.
  1st one is frmStudentDetails. It has a datagrid
  2nd one is frmStudentRegistration. It has some text boxes and Add button</p>
  
  <p>When user enter some information and press "Add" button, I want to add those to the datagrid one by one</p>
  
  <p>For accomplish that 1st I created following method in frmStudentDetails </p>
  
  <pre><code>    public void AddRecord(string StID, string Name)
      {
         DataGridViewRow row = (DataGridViewRow)dgvStDetails.Rows[0].Clone();
         row.Cells[0].Value = StID;
         row.Cells[1].Value = Name;
  
         dgvStDetails.Rows.Add(row);
      }
  </code></pre>
  
  <p>I called it on frmStudentRegistration form's add button --></p>
  
  <pre><code>    private void btnAdd_Click(object sender, EventArgs e)
      {
         frmStudentDetailsForm frm = new frmStudentDetailsForm();
         frm.AddRecord(txtStudentID.Text, txtStName.Text);
         frm.ShowDialog();
      }
  </code></pre>
  
  <p>Then the problem is, itz generating new forms to show every new record.
  But i want to add all records in one form.</p>
  
  <p>please somebody help me for that</p>