private decimal[] d;
d = new decimal[31];
for(int count = 0; count < myVariable; count++)
{
d[count] = Convert.ToDecimal(myGrid.Rows[e.RowIndex].Cells[count].Value);
}
myGrid.Rows[e.RowIndex].Cells.Value = d[0] + d[29];
I added this in CellEndEdit event.
Or Try This
decimal total = 0M;
foreach(DataGridViewRow row in datagridview1.Rows)
{
decimal temp = 0M;
if(Decimal.TryParse(dataGridView[0, row.Index].Value.ToString(), out temp))
total += temp;
}
datagridview1[0, datagridview1.Rows.Count -1].Value = total.ToString();
Or See This Link
http://www.timvw.be/2007/01/04/developing-a-datasource-for-your-datagridview/[
^]
Accept This Answer If It Has Helped You