Skip to content

Datagridview bound to bindingsource with .datasource

Rambo Vincent

Asked Dec 14, 2015, 3:24 PM EST2 answers
Share
LinkedInX
I have a datagridview bound to bindingsource which is pulling from dataset. When a value changes by user at runtime in the datagridview cells the changes are not saved to bindingsource. I tried calling binsingsource.endedit and datagrid.endedit but neither save the data without clicking outside of the grid and changing a value elsewhere (leaving grid focus) .... I'm at wits end with datagridview and bindingsources not saving my values. I tried even using dirtycell and cell value changed events with endedit but the value won't save to dataset or binsingsource unless focus leaves grid! Whyyy

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Here's more details. The data view combo boxcolumn in the grid view is the only value not saving unless leave focus and is itself also set to have a datasource in addition the the grid, of a datatable with the values id's of the lookup bindingsource that is bound to the grid... I think this is why how do I get around this issue?
    0
  • 0
    I figured it out. While I have datagridview bound to bindingsourceA, I also have DataRowViewComboBoxColumn within that grid bound to bindingsourceB with value member and display member in bindingsourceB. But - I did not have the combobox's column ALSO set to DataPropertyName bindingsourceA.LookupID! This did it! Thanks.
    0