Related DataGridView issue
I have a bound DataGridView that allows new rows to be added. The problem is that a new object is automatically inserted into the binding source when CurrentRow is the last row of the grid. I want the new object to be added to the anchor source only when the user starts typing text in one of the last cells of the line.
a source to share
This is not the way DataGridView
, and having tried before to change the way new elements are added, I must warn you against trying it.
Your best bet is to ensure that your binding source implements the interface ICancelAddNew
. If implemented, it DataGridView
will be called CancelNew
if the user leaves the row without entering any data into the new element. You can also use BindingList<T>
as a data source or wrap your data source in BindingSource
; both of these classes implement ICancelAddNew
.
a source to share