开发者

Update datasource from view values (WinForms DataGridView)

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜