0

How can I catch value Cell in DataGridView when user editing this cell?

I would validate on "real-time" input text.

RajeshKdev
  • 6,365
  • 6
  • 58
  • 80
Tomasz Filipek
  • 579
  • 1
  • 6
  • 17

1 Answers1

0

You can use CellEndEdit event for DataGridView.

Adding CellEndEdit Event

Then you can access cell value using following code

((DataGridView)sender).Rows[e.RowIndex].Cells[e.ColumnIndex].Value

I just displayed data in the cell in messagebox. Code will look like:

 private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
    {
        MessageBox.Show(((DataGridView)sender).Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
    }
Sria Pathre
  • 182
  • 1
  • 10