I tried to to that as:
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
string name = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
}
It induces an exception System.NullReferenceException
always when I edit cell.
There is no error :/ , but to get the changed value you shoud use another Event:
private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
String name = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
}
And every time will be saved changed value in the variable "name" :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.