I am developing a window application in which I have a datagridview. I get the data in datagridview from database and have added checkbox column in datagridview. when the checkbox is checked the value should be shown in label, for that I have written foreach loop and its working but,
when the user checks the first row the value is not refreshed, it gets refreshed when focus from first row is leaved.
Which is the appropriate datagridview event ??
The code I have written
- Amt = 0;
- foreach (DataGridViewRow dgr in dgvDetails.Rows)
- {
- if (Convert.ToBoolean(dgr.Cells[0].Value) == true)
- {
- Amt += Convert.ToInt32(dgr.Cells[12].Value.ToString());
- }
- txtCash_Amt.Text = Amt.ToString();
- }