all groups > dotnet windows forms databinding > september 2006 >
You're in the

dotnet windows forms databinding

group:

Behavior of IBindingList's EndNew and CancelNew


Behavior of IBindingList's EndNew and CancelNew Sam Carleton
9/11/2006 5:44:44 AM
dotnet windows forms databinding: 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
Re: Behavior of IBindingList's EndNew and CancelNew Bart Mermuys
9/17/2006 7:11:12 PM
Hi,

[quoted text, click to view]

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



[quoted text, click to view]

AddThis Social Bookmark Button