title: how to append new row to the datagridview and keep existing rows?
body: <p>I have laboratory request window, i can create the new requests later on some times i need to update this order i made the update window and I read the order details from the database in datagrid view and i need to add new items to the datagridview, but the error when i add new row the existing rows removed and add the new row what is the error with my code and i am adding new row.
  How to add new row and keep existing rows, also check the attached files datagridview image before press enter key and datagridview1 image after press enter its add new row and remove the existing rows fetched from the database.</p>
  
  <pre><code>private void textAmount_KeyDown(object sender, KeyEventArgs e)
          {
              if (e.KeyCode == Keys.Enter &amp;&amp; textQty.Text != string.Empty &amp;&amp; textAmount.Text != string.Empty)
              {
                  if (chkcash1.Checked == true)
                  {
                      textDiscount.Focus();
                  }
                  if (chkcash1.Checked == false)
                  {
                      for (int i = 0; i &lt; TestsDataGrid.Rows.Count - 1; i++)
                      {
                          if (TestsDataGrid.Rows[i].Cells[0].Value.ToString() == textTestId.Text)
                          {
                              MessageBox.Show("This test added already ", "Duplicate Test", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                              return;
                          }
                      }
                      DataRow r = dt.NewRow();
                      r[0] = textTestId.Text;
                      r[1] = textName.Text;
                      r[2] = textPrice.Text;
                      r[3] = textQty.Text;
                      r[4] = textAmount.Text;
                      r[5] = textTotal.Text;
  
  
                      dt.Rows.Add(r);
                      TestsDataGrid.DataSource = dt;
                      textTestId.Clear();
                      textName.Clear();
                      textPrice.Clear();
                      textAmount.Clear();
                      textTotal.Clear();
                      btnSearch.Focus();
  
                      textOrderTotal.Text = (from DataGridViewRow row in TestsDataGrid.Rows
                                             where row.Cells[4].FormattedValue.ToString() != string.Empty
                                             select Convert.ToDouble(row.Cells[4].FormattedValue)).Sum().ToString();
                  }[datagridviewimage][1]
  </code></pre>