How to detect changes in values in the datagridview cells
I want to detect changes in values in cells. but it is not working. I have given the code.
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
Int32 selectedCellCount = dataGridView1.GetCellCount(DataGridViewElementStates.Selected);
if (selectedCellCount > 0)
{
for (int i = 0; i < selectedCellCount; i++)
{
row = dataGridView1.SelectedCells[i].RowIndex;
col = dataGridView1.SelectedCells[i].ColumnIndex;
}
}
//MessageBox.Show(Convert.ToString(this.dataGridView1[row, col].Value));
this.dataGridView1.CurrentCell = this.dataGridView1[col + 1, row];
int a = Convert.ToInt32(this.dataGridView1[col, row].Value);
int b = Convert.ToInt32(this.dataGridView1[col - 1, row].Value);
this.dataGridView1.CurrentCell.Value = a * b;
}
Please give me solution regarding this problem
Regards,
Shomen Deb