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/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.