int a, b;
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
b = (dataGridView1.CurrentRow.Index);
if ((dataGridView1.Rows[b].Cells[0].Value) != null)
{
if (dataGridView1.CurrentCell.ColumnIndex==0)
{
a=Convert.ToInt32(dataGridView1.Rows[b].Cells[0].Value);
b=convert.ToInt32(dataGridView1.Rows[b].Cells[1].Value);
dataGridView1.Rows[b].Cells[2].Value=(a-b)+1;
}
}
}
|