How to intercept binding navigator delete method?

micheal

Member
Joined
Nov 8, 2011
Messages
6
Location
Malaysia
Programming Experience
Beginner
Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click


If MessageBox.Show("Are you sure?", "", MessageBoxButtons.YesNo) =
Windows.Forms.DialogResult.Yes Then
ItemBindingSource.RemoveCurrent()
End If
End Sub

'this code will delete with yes/no click by user,how to do it better?
please help,your kind help much more appreciated.
 
By default the bindingnavigator has assigned buttons to default actions, check its properties. For example DeletedItem property has been assigned the BindingNavigatorDeleteItem button, and when button is clicked it invokes that action on the bindingsource automatically. This behaviour is explained in the main help topic for BindingNavigator Class
If you remove that assignment for DeleteItem property you can perform you custom code only for the buttons click event handler like what you posted.
 
Back
Top