473,395 Members | 2,446 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,395 software developers and data experts.

Delete warning with bindingnavigator

Hi

When I press the delete button on the BindingNavigator it deletes the record
without any warning. How can I add a warning dialog when the delete button
on the BindingNavigator is pressed and before the record is actually
deleted?

Thanks

Regards
Nov 21 '05 #1
5 14137
Hi,

I wish the bindingnavigatordelete_click event allowed you to
cancel the delete of the row. If you are bound to a dataset you can add a
handler to the rowdeleted event and undo the delete. Not the best solution
but it works

AddHandler AdventureWorksDataSet.Tables(0).RowDeleted, AddressOf
Row_Deleting
Private Shared Sub Row_Deleting(ByVal sender As Object, _
ByVal e As DataRowChangeEventArgs)
If MessageBox.Show("Are you sure?", "", MessageBoxButtons.YesNo) =
Windows.Forms.DialogResult.No Then
e.Row.RejectChanges()
End If
End Sub

Ken
----------------
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
Hi

When I press the delete button on the BindingNavigator it deletes the
record without any warning. How can I add a warning dialog when the delete
button on the BindingNavigator is pressed and before the record is
actually deleted?

Thanks

Regards

Nov 21 '05 #2
Doesn't seem to work for me. The msgbox never appears. I am using the
BindingNavigator. Do I need to change anything at that end?

Regards

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:e5*************@TK2MSFTNGP15.phx.gbl...
Hi,

I wish the bindingnavigatordelete_click event allowed you to
cancel the delete of the row. If you are bound to a dataset you can add a
handler to the rowdeleted event and undo the delete. Not the best
solution but it works

AddHandler AdventureWorksDataSet.Tables(0).RowDeleted, AddressOf
Row_Deleting
Private Shared Sub Row_Deleting(ByVal sender As Object, _
ByVal e As DataRowChangeEventArgs)
If MessageBox.Show("Are you sure?", "", MessageBoxButtons.YesNo) =
Windows.Forms.DialogResult.No Then
e.Row.RejectChanges()
End If
End Sub

Ken
----------------
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
Hi

When I press the delete button on the BindingNavigator it deletes the
record without any warning. How can I add a warning dialog when the
delete button on the BindingNavigator is pressed and before the record is
actually deleted?

Thanks

Regards


Nov 21 '05 #3
John,

Are you binding to a dataset?

Ken
----------------
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:e5**************@TK2MSFTNGP11.phx.gbl...
Doesn't seem to work for me. The msgbox never appears. I am using the
BindingNavigator. Do I need to change anything at that end?

Regards

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:e5*************@TK2MSFTNGP15.phx.gbl...
Hi,

I wish the bindingnavigatordelete_click event allowed you to
cancel the delete of the row. If you are bound to a dataset you can add
a handler to the rowdeleted event and undo the delete. Not the best
solution but it works

AddHandler AdventureWorksDataSet.Tables(0).RowDeleted, AddressOf
Row_Deleting
Private Shared Sub Row_Deleting(ByVal sender As Object, _
ByVal e As DataRowChangeEventArgs)
If MessageBox.Show("Are you sure?", "", MessageBoxButtons.YesNo) =
Windows.Forms.DialogResult.No Then
e.Row.RejectChanges()
End If
End Sub

Ken
----------------
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
Hi

When I press the delete button on the BindingNavigator it deletes the
record without any warning. How can I add a warning dialog when the
delete button on the BindingNavigator is pressed and before the record
is actually deleted?

Thanks

Regards



Nov 21 '05 #4
Hi,

Try this instead. In the designer set the bindingnavigators
deleteitem to none. The delete button should still be there. Double click
on the delete button to get the code window to open up with the
BindingNavigatorDeleteItem_Click event open. Add the code below to control
the delete.

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
ContactBindingSource.RemoveCurrent()
End If
End Sub


Ken

-------------------------

"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:e5**************@TK2MSFTNGP11.phx.gbl...
Doesn't seem to work for me. The msgbox never appears. I am using the
BindingNavigator. Do I need to change anything at that end?

Regards

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:e5*************@TK2MSFTNGP15.phx.gbl...
Hi,

I wish the bindingnavigatordelete_click event allowed you to
cancel the delete of the row. If you are bound to a dataset you can add
a handler to the rowdeleted event and undo the delete. Not the best
solution but it works

AddHandler AdventureWorksDataSet.Tables(0).RowDeleted, AddressOf
Row_Deleting
Private Shared Sub Row_Deleting(ByVal sender As Object, _
ByVal e As DataRowChangeEventArgs)
If MessageBox.Show("Are you sure?", "", MessageBoxButtons.YesNo) =
Windows.Forms.DialogResult.No Then
e.Row.RejectChanges()
End If
End Sub

Ken
----------------
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
Hi

When I press the delete button on the BindingNavigator it deletes the
record without any warning. How can I add a warning dialog when the
delete button on the BindingNavigator is pressed and before the record
is actually deleted?

Thanks

Regards



Nov 21 '05 #5
Yes. Re-read your post and I think I am OK now.

Thanks

Regards

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
John,

Are you binding to a dataset?

Ken
----------------
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:e5**************@TK2MSFTNGP11.phx.gbl...
Doesn't seem to work for me. The msgbox never appears. I am using the
BindingNavigator. Do I need to change anything at that end?

Regards

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:e5*************@TK2MSFTNGP15.phx.gbl...
Hi,

I wish the bindingnavigatordelete_click event allowed you to
cancel the delete of the row. If you are bound to a dataset you can add
a handler to the rowdeleted event and undo the delete. Not the best
solution but it works

AddHandler AdventureWorksDataSet.Tables(0).RowDeleted, AddressOf
Row_Deleting
Private Shared Sub Row_Deleting(ByVal sender As Object, _
ByVal e As DataRowChangeEventArgs)
If MessageBox.Show("Are you sure?", "", MessageBoxButtons.YesNo)
= Windows.Forms.DialogResult.No Then
e.Row.RejectChanges()
End If
End Sub

Ken
----------------
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
Hi

When I press the delete button on the BindingNavigator it deletes the
record without any warning. How can I add a warning dialog when the
delete button on the BindingNavigator is pressed and before the record
is actually deleted?

Thanks

Regards



Nov 21 '05 #6

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

Similar topics

2
by: Dave | last post by:
I have a c# program that uses the bindingnavigator control. It works fine, but I want to add the ability for a user to change his mind after clicking 'delete' to delete a record. So if the user...
3
by: michael sorens | last post by:
I have generated an XmlDocument, then bound it to a DataGridView (thanks to a pointer from PeterBromberg in a separate, recent posting). Now I want to connect a BindingNavigator, but my rudimentary...
0
by: peterlewis | last post by:
Hi, I am unable to delete the current record from bindingnavigator - has a null bindingSource.Current although I can insert new records. The bindingnavigator was added as a control and the data...
7
by: Dale Sampson | last post by:
As you can tell, I am new to VS.net. I have a VB project with a defined data source pointing to a table in a ..mdb file.-- The associated fields are displayed in textboxes using the...
2
by: csharpa | last post by:
Hi, I’m using VS2005 and the bindingnavigator control. Right now I’m using 2 bindingnavigator control (each for one table) in order to generate the new ID when I clicked the ‘add new” button. But...
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
by: kareem100 | last post by:
Hi, I have just started learning visual basic ( using visual basic express) and i have run into a problem that I can't resolve. I am using a bindingnavigator on a form. The thing is that when...
1
nev
by: nev | last post by:
i have a bound datagridview which has no data yet. it has a bindingnavigator along with it. enable adding, editing & deleting of rows is checked. now here's the scenario... when i run the program,...
0
by: sincos | last post by:
Hello, First, sorry for my English, I hope you will understand me:) I'm new in using C Sharp and more with the bindingNavigator. What I would do is to simulate the button "add"...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.