Hay Microsoft, I am trying to implement an advanced BindingList, one
that supports adding and deleted rows while filtered. I am having a
bear of a time making heads or tails of the rules for when EndNew() and
CancelNew() are called. I have gone ahead and written a test program to
see when they get called. Here is what I am seeing:
the DataGridView starts with two lines and neither function has been
called. As soon as I click on the new row, I get this:
EndNew(0)
EndNew(0)
AddNewCore()
InsertItem(2, )
EndNew(-1)
EndNew(0)
When I click on the second row (cancel the add) I get this:
CancelNew(2)
RemoveItem(2)
EndNew(2)
If I where to make changes and then click on the second row, to commit
the changes I get this:
EndNew(2)
EndNew(2)
My best guess is that the EndNew() should be ignored unless the index
is that of the last InsertItem(). My real question is:
Microsoft is there any offical documentation out there regarding what
the behavior is on this?
Sam Carleton
Bart Mermuys - 17 Sep 2006 20:11 GMT
Hi,
> Hay Microsoft, I am trying to implement an advanced BindingList, one
> that supports adding and deleted rows while filtered. I am having a
[quoted text clipped - 29 lines]
> Microsoft is there any offical documentation out there regarding what
> the behavior is on this?
I guess it's also called on EndEdit and CancelEdit, but according to Net.
SDK Doc, you should compare the index with the last (pending) added index
(AddNew) like you mentioned.
see
http://msdn2.microsoft.com/en-us/library/system.componentmodel.icanceladdnew.aspx
---
HTH,
Greetings
> Sam Carleton