DataGrid end edit
-
I have a simple windows form with a DataGrid bound to a dataset from a database. When the form closes (event 'Closing') I want to flush all changes made in the grid to the database. Everything is fine except the current cell...if I have not left the cell, the data is not updated. So far I have tried
private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e) { System.Windows.Forms.DataGridCell cell = this.dataGrid1.CurrentCell; DataGridColumnStyle dgc = this.dataGrid1.TableStyles[0].GridColumnStyles[cell.ColumnNumber]; bool good = this.dataGrid1.EndEdit(dgc, this.dataGrid1.CurrentRowIndex, false ); this.oleDbDataAdapter1.Update( this.dataSetFeature1 ); }
without luck. Does any one know how to get the current state of the cell into the dataset during 'Closing'? thanks in advance cje