tattoo

When using the Binding Navigator Is there a way that when I pclick on the Button to delete a record, that I can ask the user if they realy want to delete the record

In my App I also have button controls that the user can press, and when they press my button to delete it asks them to confirm the delete. If they do then I call the BindingNavigatorDeleteItem . PerformClick() event.

But If the user clicks on the "BindingNavigatorDeleteItem button on the Navigator Bar they don't get that option...

Any ideas

thanks

tattoo



Re: Visual Basic Language Binding Navigator Question

anubisascends

Yup, you can add the following code to the sub that deletes the items.:

Code Snippet

Dim result as DialogResult

result = messagebox.show([create your messagebox here])

If result = DialogResult.OK Then

[normal delete code]

End If






Re: Visual Basic Language Binding Navigator Question

tattoo

Thanks for your response but,

If I put nothing in the BindingNavigatorDeleteItem_Click() event. the record still seems to get deleted.

So even if I add your code as shown above, if my DialogResult.OK is true or not the record is still removed...

does this make sense /

thanks





Re: Visual Basic Language Binding Navigator Question

anubisascends

You could delete the button, then add your own and assign it the code to delete.




Re: Visual Basic Language Binding Navigator Question

tattoo

When I click on the delete button that is created with a binding navigator, isn't there some code somewhere that is invoked to delete records in the dataset

I just want to be able to trap that and only do it based on the user's response. I did create my own button and when the user verified that he wants to delete I call the "BindingNavigatorDeleteItem.Click" event. However, I don't understand why I should need to re-invent the wheel in order to delete something.

Surely other programmers want to ensure that a user can confirm a record delete without creating their own Delete Buttons.

thanks

tattoo





Re: Visual Basic Language Binding Navigator Question

Trayc-IAFG

Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click

Dim reply As Integer

reply = MsgBox("Are you sure you want to delete Deletions can NOT be undone!", MsgBoxStyle.YesNo)

If reply = 7 Then

Exit Sub

Else

'do code to delete

end if

end sub





Re: Visual Basic Language Binding Navigator Question

tattoo

OK, great, I think it was the "Exit Sub" that I was missing

thanks very much....

tattoo