PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Weird BindingList - BindingSource problem: Add(New)/Insert/... not called

Reply

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

 
Thread Tools Rate Thread
Old 07-04-2006, 08:02 AM   #1
Pieter
Guest
 
Posts: n/a
Default Weird BindingList - BindingSource problem: Add(New)/Insert/... not called


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


  Reply With Quote
Old 07-04-2006, 08:59 AM   #2
Pieter
Guest
 
Posts: n/a
Default Re: Weird BindingList - BindingSource problem: Add(New)/Insert/... not called

Ok nevermind: I had to shadow the methods, and it was the Protected
Overrides Sub InsertItem-method that was called...

"Pieter" <pietercoucke@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
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off