I'm getting the following message when I try to remove the last item in a datagridview.
DataBinding cannot find a row in the list that is suitable for all bindings.
I have my binding setup as follows.
ExtendedBindingList<MyClass> bl = new ExtendedBindingList<MyClass>(GetDataFromDB());
BindingSource bs = new BindingSource();
bs.DataSource = bl;
dgv.DataSource = bs;
ExtendedBindingList is just something simple I threw together to implement sorting and filtering and some basic state persistence. dgv is the DataGridView. GetDataFromDB returns a List of MyClass.
The issue only arises when I try to remove the last item from the datagridview using:
bs.RemoveCurrent();
which works at all other times. My only hint for a solution is to remove all bindings and reapply them but this doesn't seem like an ideal solution.
EDIT The exception only gets thrown after the BindingList successfully removes the last item in question. It get's thrown in external code so I can't tell exactly what is throwing it.
So, here I am, asking SO for some help :).
Thanks in advance, Justin