Hi all,
I hope your all alright. I am designing a cash denomination calculator and below is the code I have used.
private void dataGridView1_CellValidated_1(object sender, DataGridViewCellEventArgs e)
{
DataGridViewRow row = dataGridView1.Rows[e.RowIndex]
int a = System.Convert.ToInt32(row.Cells[ColumnA.Index].Value);
int b = System.Convert.ToInt32(row.Cells[ColumnB.Index].Value);
int c = (a * b);
row.Cells[ColumnC.Index].Value = c.ToString("n0");
dataGridView1.Columns["ColumnB"].Width = 170;
dataGridView1.Columns["ColumnC"].Width = 200;
}
However I have failed to find a way of getting the sum of the values for all rows of column, Is there a way I can get the sum of all rows of a column of a datagridview and display it in a textbox.text or a label.text