Home All Groups Group Topic Archive Search About

Weird BindingList - BindingSource problem: Add(New)/Insert/... not called

Author
7 Apr 2006 7:02 AM
Pieter
Hi,

I have a custom List that inherits from BindingList.
It has some methods overloaded, like the Add/Insert/etc to add and remove
some eventhandlers when adding or removing an item T of the list.

The problem happens when:
- I use such a BindingList as DataSource for a BindingSource.
- Add this BindingSource as DataSource for a DataGridView.
- And go to the NewRow and add a new row in the DataGridView.

None of the overloaded Add/AddNew/AddNewCore/Insert/InsertAt of my
BindingList are called! So the eventhandlers aren't added to the newly added
object neither. But when I look at my BindingList, it has an Item added...
So somehow this Item is added to the BindingList, but not via the 'normal'
ways?

How does this come, and how to avoid this? I just don't get it that a new
Object is added, without using the overloaded functions of my BindingList??

Anybody has any idea? And a solution?

Any help will be really appreciated!
Thanks a lot in advance,

Pieter

Author
7 Apr 2006 7:59 AM
Pieter
Ok nevermind: I had to shadow the methods, and it was the Protected
Overrides Sub InsertItem-method that was called...

Show quote
"Pieter" <pietercou***@hotmail.com> wrote in message
news:eNsIQFhWGHA.4452@TK2MSFTNGP04.phx.gbl...
> Hi,
>
> I have a custom List that inherits from BindingList.
> It has some methods overloaded, like the Add/Insert/etc to add and remove
> some eventhandlers when adding or removing an item T of the list.
>
> The problem happens when:
> - I use such a BindingList as DataSource for a BindingSource.
> - Add this BindingSource as DataSource for a DataGridView.
> - And go to the NewRow and add a new row in the DataGridView.
>
> None of the overloaded Add/AddNew/AddNewCore/Insert/InsertAt of my
> BindingList are called! So the eventhandlers aren't added to the newly
> added object neither. But when I look at my BindingList, it has an Item
> added... So somehow this Item is added to the BindingList, but not via the
> 'normal' ways?
>
> How does this come, and how to avoid this? I just don't get it that a new
> Object is added, without using the overloaded functions of my
> BindingList??
>
> Anybody has any idea? And a solution?
>
> Any help will be really appreciated!
> Thanks a lot in advance,
>
> Pieter
>

AddThis Social Bookmark Button