I have a dataGridView and when I do some modifcations I want to get those modified records.
For that I'm using this command
DataTable dt = ((DataTable)this.dataGridView1.DataSource).GetChanges(DataRowState.Added)
But the problem is when I add a row press save button without doing tabout..that record is not going to the database. Can anyone tell me how to overcome this issue.
Loading
garukaPosted Sep 23, 2009, 9:55 AM
And also text_chaged event is fired after u tab out from the cell I belive...isn't it?
Roei BarPosted Sep 22, 2009, 11:47 AM
DataTable dt = new DataTable();
then copy the datasource like this:
dt = dgv.DataSource as DataTable;
and add an event on the DataGrid for TextChanged
on the TextChanged EVent update the dt.
by this
private void dgv_TextChanged(object sender ,CellEventArgs e)
{
//here you can look in the dgv by dgv[e.Row,e.Column] and goto dt
DataTable to update that cell
}
garukaPosted Sep 22, 2009, 11:27 AM
I'm not sure. The actualy problem is I have my MDI form and I'm using the MDI form save button to save the child window. So if someone do something in this form which has a dataGridView and press the save button in MDI i want to save everything.
It's working fine except for the last record, if I didn't tabout before press the save.
I'm not sure how to do that in your way.
Could you please post a lille code sample or something.
Cheers,
/G
Roei BarPosted Sep 22, 2009, 11:17 AM