DataGridView Not Assuming All Changes
Hi
I have a problem with a form that has 4 datagridviews, every datagridview has is own datasource (datatables), the user can change everything in the datagrids, at any point the user can select SAVE and all the datasources are updated (table adapters with my own sp's), or that was what was supposed to happen...
After some tests i noticed that some cells doesn't are saved....
For example i have several combos in the datagrids, the UI shows the value that the user selected, but when saving it assumes the original value or nothing... Kind of the value wasn't committed by the control, but this happens in normal text cells...
Before saving i call the end edit for each datagrid, and select another control in the form just to ensure that none of the datagrids are selected.
What i'm missing here?
I recall reading somewhere that the rows in the datagridview can have a intermediary state... but i don't know where i read that....
Re: DataGridView Not Assuming All Changes
Hi,
I know that you have said that you have called EndEdit on the DataGridView but I am not sure if that has the same affect as calling EndEdit on the BindingSource which Ensures that all pending changes are flushed to the underlying DataSource in the project. Have a look here:-
BindingSource.EndEdit Method
Hope that helps.
Cheers,
Ian
Re: DataGridView Not Assuming All Changes
I dont use any binding source...
Re: DataGridView Not Assuming All Changes
Hi,
I would guess then that this is the potential issue.
I would recommend adding a BindingSource between each DataTable and DataGridView and then set the DataGridView's DataSource to each BindingSource. Once done, you can then call EndEdit on each BindingSource rather than each DataGridView which I suspect will solve your intermittent issues.
Hope that helps.
Cheers,
Ian