How can I catch value Cell in DataGridView
when user editing this cell?
I would validate on "real-time" input text.
How can I catch value Cell in DataGridView
when user editing this cell?
I would validate on "real-time" input text.
You can use CellEndEdit
event for DataGridView
.
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());
}