Menu

#5 Refresh while Grid is in AddingNew state

open
nobody
None
5
2011-04-11
2011-04-11
Anonymous
No

If there is Refresh() called on BindingListView from user code, while DataGridView, bound to BindingListView, is in AddingNew state (someone started to write to new row but did not finish or cancel it), then the Refresh() finishes adding of the new row without canceling the AddingNew state of DataGridView. Almost any action in DataGridView then results in yet another row added. This is especially inconvenient when the grid is empty, because then the grid is in AddingNew state by default.

Solution to this is to assure, that bound DataGridView is not in AddingNew state before Refresh method is called. E.g. to call
BS.CancelEdit();
BS.AllowNew = false;
BS.AllowNew = true;
on BindingSource used Between BindingListView and DataGridView.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.