473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Need for BindingSource.Removing event

Hello:

I have a BindingSource that has its DataSource set to a
BindingList<Customerwhere Customer is a business object that
manipulates a DataRow. All changes to a Customer instance, update a
DataTable via DataRow.

It is fairly easy to add a new item to the BindingSource. However,
removing is a different story. I need to be able to know when an item
is removed because I would like to call Delete on the DataRow. I need
to be able to access the item being removed and do it there.

However, the best thing available is ListChanged, and it is pretty
useless for what I am doing. I suppose I could inherit from
BindingSource and overload the methods and add an event.

Is this the way to go? or is there something built in?

~Travis
Dec 11 '07 #1
2 3416
Travis,

Unfortunately, the BindingList doesn't have a ListChanging event.
Personally, I would derive a class from BindingList<Tand then override the
RemoveItem method to fire a ListChanging event, which is fired before the
item is removed from the list.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<je**********@gmail.comwrote in message
news:a4**********************************@b1g2000p ra.googlegroups.com...
Hello:

I have a BindingSource that has its DataSource set to a
BindingList<Customerwhere Customer is a business object that
manipulates a DataRow. All changes to a Customer instance, update a
DataTable via DataRow.

It is fairly easy to add a new item to the BindingSource. However,
removing is a different story. I need to be able to know when an item
is removed because I would like to call Delete on the DataRow. I need
to be able to access the item being removed and do it there.

However, the best thing available is ListChanged, and it is pretty
useless for what I am doing. I suppose I could inherit from
BindingSource and overload the methods and add an event.

Is this the way to go? or is there something built in?

~Travis

Dec 11 '07 #2
On Dec 11, 12:09 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Travis,

Unfortunately, the BindingList doesn't have a ListChanging event.
Personally, I would derive a class from BindingList<Tand then override the
RemoveItem method to fire a ListChanging event, which is fired before the
item is removed from the list.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

<jehugalea...@gmail.comwrote in message

news:a4**********************************@b1g2000p ra.googlegroups.com...
Hello:
I have a BindingSource that has its DataSource set to a
BindingList<Customerwhere Customer is a business object that
manipulates a DataRow. All changes to a Customer instance, update a
DataTable via DataRow.
It is fairly easy to add a new item to the BindingSource. However,
removing is a different story. I need to be able to know when an item
is removed because I would like to call Delete on the DataRow. I need
to be able to access the item being removed and do it there.
However, the best thing available is ListChanged, and it is pretty
useless for what I am doing. I suppose I could inherit from
BindingSource and overload the methods and add an event.
Is this the way to go? or is there something built in?
~Travis- Hide quoted text -

- Show quoted text -
My thoughts exactly. Now I just have to figure out how to make
everyone aware of it.

Thanks,
Travis
Dec 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: TN | last post by:
I just don't get the BindingSource class when it is bound to a class. Consider this code snip: ..... Private bSource As New BindingSource() Private dgv As New DataGridView() Public Sub New()...
0
by: Geoff | last post by:
Hi folks Calling BindingSource.ResetCurrentItem() is changing the BindingSource.Position in a way I don't understand. If I'm understanding the docs correctly, ResetCurrentItem() should simply...
1
by: Pieter | last post by:
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...
3
by: msnews.microsoft.com | last post by:
Greetings I have a a simple application with 1 form. On my form I use a BindingSource to bind a database table to a "table (gridDataView)" (one in the database, one on my form, 2 different...
0
by: Rick | last post by:
VS 2005 I have some custom business objects (BindingList(of T)) connected through BindingSources to a BindingNavigator. When the user moves focus the BindingSource of the navigator can be...
0
nev
by: nev | last post by:
When bindingsource.addnew, it fires positionchanged event. When movenext, moveprevious, etc, it also fires positionchanged event. If I am to place code in positionchanged event, how will I...
1
by: Daniel Jeffrey | last post by:
..Net 2.0 VStudio 2005 C# I know this is going to seem like a strange question, as even I am sure I have missed something - but I cant find it. I want a simple event on any of the objects...
0
nev
by: nev | last post by:
Hello all. I would like to place code when bindingsource is being filtered. I have tried placing it in the positionchanged and listchanged event. But, when I try to filter the bindingsource, it...
2
by: jehugaleahsa | last post by:
Hello: I'm working on improving some of our Windows Forms. I have created two user controls that I want to bind to the same BindingSource. I have an overview control that is used just to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.