I get the following message when I try to delete the last item in a datagridview.
DataBinding cannot find a row in the list that is suitable for all bindings.
I have a snap setting as follows.
ExtendedBindingList<MyClass> bl = new ExtendedBindingList<MyClass>(GetDataFromDB()); BindingSource bs = new BindingSource(); bs.DataSource = bl; dgv.DataSource = bs;
The ExtendedBindingList is just something simple I put together to sort and filter and some basic state persistence. dgv is a DataGridView. GetDataFromDB returns a list of MyClass.
The problem only occurs when trying to remove the last item from a datagridview using:
bs.RemoveCurrent();
which works at any other time. My only hint of a solution is to remove all the bindings and reapply them, but that doesn't seem like the perfect solution.
EDIT An exception occurs only after the BindingList successfully deletes the last item in question. It gets into external code, so I can’t say for sure what throws it.
So here I am, asking for help :).
Thanks in advance, Justin
c # data-binding winforms bindinglist bindingsource
Justin drury
source share