I am changing DataGridView cell values programmati开发者_如何学Gocally, but values are not pushed to bound datasource. They are pushed only for cells belonging to selected row. How can I ask the DataGridView to push rows values into datasource?
EDIT:
This code seems to do the trick, but may be some better solution?
grid.CurrentCell = cell;
cell.Value = "some value";
grid.EndEdit(0);
You shouldn't update the DataGridView
cells, instead you should directly update the data source. If it implements INotifyPropertyChanged
, the DataGridView
will reflect the changes automatically
精彩评论