PC Review


Reply
Thread Tools Rate Thread

Detecting BindingSource "row deleted" event

 
 
Tomasz J
Guest
Posts: n/a
 
      27th Sep 2007
Hello Developers,

I have a DataGridView and BindingNavigator controls bound to a BindingSource
control.
User can delete a record using different methods: by pressing the DEL key,
pressing BindingNavigator Delete button. I may also want to add some other
methods calling BindingSource.RemoveCurrent().

How do I detect BindingSource "row deleted" event and get deleted row
reference, so I can post changes?

I would appreciate any hints.

Tomasz J


 
Reply With Quote
 
 
 
 
Jeffrey Tan[MSFT]
Guest
Posts: n/a
 
      28th Sep 2007
Hi Tomasz,

Getting the row deletion notification is easy. You may use
BindingSource.ListChanged event for this task. In this event, you may check
if the current list change type is ListChangedType.ItemDeleted. The code
snippet below demonstrates the logic:

private void bindingSource1_ListChanged(object sender, ListChangedEventArgs
e)
{
if (e.ListChangedType == ListChangedType.ItemDeleted)
{
}
}

However, to get the current deleted rows, there is no simple and easy way.
BindingSource.ListChanged is a completed event which fires after the row
deletion is done. When this event is firing, the row is already deleted
from the DataView. By default, the DataView will filter out these deleted
rows with DataView.RowStateFilter property.

The workarounds we have are:
1. If you are binding to the DataTable/DataSet, you may use
DataTable.RowDeleting event to get the deletion notification. And the
DataRowChangeEventArgs.Row will point to the current deleting row.
2. You have to catch all the deletion operations at various UI controls ,
such as DataGridView, BindingNavigator etc.. and find out the current
deleting rows

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


 
Reply With Quote
 
Tomasz J
Guest
Posts: n/a
 
      28th Sep 2007
Hello Jeffrey,

Catching all the deletion operations at various UI controls is precisely
what I am trying to avoid.

But I did not think about using DataTable.RowDeleting event - thank you.

BindingSource.ListChanged is useless for this purpose.
I think this BindingSource control functionality should really be improved.
Currently it is good only for MSDN demos.

Thanks,

Tomasz


 
Reply With Quote
 
Jeffrey Tan[MSFT]
Guest
Posts: n/a
 
      30th Sep 2007
Hi Tomasz,

Thank you for the feedback.

Yes, I agree the BIndingSource control model is not rich enough for your
special requirement. I would recommend you to submit a suggestion feedback
in the link below. The request will finally file in the Winform dev team
database for consideration:
https://connect.microsoft.com/Visual...?wa=wsignin1.0

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
Tomasz J
Guest
Posts: n/a
 
      1st Oct 2007
I did as you suggested.
https://connect.microsoft.com/Visual...dbackID=301811

Tomasz J


 
Reply With Quote
 
Jeffrey Tan[MSFT]
Guest
Posts: n/a
 
      2nd Oct 2007
Hi Tomasz,

Thank you for the feedback.

You may monitor this connect link and wait for the response from the dev
team. Note: the dev team does not have the same policy as MSDN newsgroup
support, so they may take a long time to response.

Anyway, if you need further help, please feel free to post, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
Tomasz J
Guest
Posts: n/a
 
      2nd Oct 2007
Well, the resolution, if ever provided, may take two full .Net Framework
releases.



Tomasz J


 
Reply With Quote
 
Jeffrey Tan[MSFT]
Guest
Posts: n/a
 
      4th Oct 2007
Hi Tomasz,

Yes, this type of design feature request has gone out of the newsgroup
support decision. Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BINDINGSOURCE.ENDEDIT CAUSES "COLUMN DOES NOT ALLOW NULLS" ERROR Cam Microsoft VB .NET 1 24th Mar 2008 09:08 PM
Databinding: "BindingSource - field" syntax Marc Vangrieken Microsoft Dot NET Framework Forms 2 11th Aug 2006 10:43 AM
"Event ID 1058" and "Event ID 1030" KB article does not apply Ray Windows XP General 0 16th Jan 2004 02:40 AM
Items Deleted from "Activities" Tab in "Contacts" dont show in trash Mark Hoenig Microsoft Outlook 0 22nd Dec 2003 11:48 PM
How to move "Junk E-mail" to "Deleted Items" folder automatically? pwalker Microsoft Outlook 2 8th Nov 2003 06:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:42 AM.