title: datagridview multiplying cell value
body: <p>I have a problem with <code>DataGridView</code>. I want to multiply two cells and display the result in a third cell.</p>
  
  <p>I have two <code>DataGridView</code>s. The first <code>DataGridView</code> gets data from database. The second <code>DataGridView</code> gets values after I select row from first <code>DataGridView</code> and adds that row to second <code>DataGridView</code>. Column A gets from first <code>DataGridView</code> (from database); in column B the user inserts values manually.</p>
  
  <pre><code>example of second datagridview: 
  Price |  Amount  |  Total
  10.50 | 2        | 21.00
  5.20  | 4        | 20.80
  7.30  | 5        | 36.50
  </code></pre>
  
  <p>After that I want to sum column C and display the sum in a text box.</p>
  
  <p>Column A is type decimal; Column B is integer; Column C should be decimal too.</p>
  
  <p>This is solution that one guy gave me on internet but it works only for <code>DataGridView</code> that gets data manually, it doesn't work if data is from database:</p>
  
  <pre><code>decimal sum = 0.0m;
  
  for (int i = 0; i &lt; gridProizvodi.Rows.Count; i++)
  {
      DataGridViewRow row = gridProizvodi.Rows[i];
      if (row.IsNewRow) break;
      decimal product = Convert.ToDecimal(row.Cells[1].Value)
                      * Convert.ToInt32(row.Cells[2].Value);
  
      sum += product;
      row.Cells[3].Value = product;
  }
  
  txtCijena.Text= sum.ToString();
  </code></pre>
  
  <p>I get an <code>argument out of range exception was unhandled</code> error in this line</p>
  
  <pre><code>decimal product = Convert.ToDecimal(row.Cells[1].Value)
                  * Convert.ToInt32(row.Cells[2].Value);
  </code></pre>
  
  <p>Can someone help me find a solution?</p>