title: to assign value to a particular cell of datagridview
body: <p>I have a <code>datagridview</code> view which has quantity and price whose multplied value should be displayed in amount column of the <code>dgview.</code> I am pasting the code tried so far.But it throws error in the following line.</p>
  
  <pre><code> dgvpricelist.Rows[i].Cells["totalamount"].Value = totalprice;
  </code></pre>
  
  <p>The error thrown is <code>"Stack overflow exception error"</code>.Have no idea why the error is thrown</p>
  
  <pre><code> public void totalcalculation()
      {
  
          if (dgvpricelist.Rows.Count &gt; 1)
          {
              double TAmount = 0;
  
              for (int i = 0; i &lt; dgvpricelist.Rows.Count; i++)
              {
                  int quantity = Convert.ToInt32(dgvpricelist.Rows[i].Cells["quantity"].Value);
                  double itemPrice = Convert.ToDouble(dgvpricelist.Rows[i].Cells["intpricelvl1"].Value);
  
                  totalprice = quantity * itemPrice;
                  dgvpricelist.Rows[i].Cells["totalamount"].Value = totalprice;
  
                  edittotalprice = Convert.ToDouble(dgvpricelist.Rows[i].Cells["totalamount"].Value);
                  TAmount += edittotalprice;
                  //txtboxtaxvalue.Text = tax.ToString();
                  //txtboxtotalvalue.Text = total.ToString();
                  //TAmount = edittotalprice;
              }
  
              int roundedtotal = (int)Math.Round(TAmount);
              txtboxstotalvalue.Text = TAmount.ToString();
              txtboxtotalvalue.Text = roundedtotal.ToString();
          }
  </code></pre>
  
  <p>May I know what is the correct way to achieve my objective?</p>