473,671 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete warning with bindingnavigato r

Hi

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

Thanks

Regards
Nov 21 '05 #1
5 14185
Hi,

I wish the bindingnavigato rdelete_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 AdventureWorksD ataSet.Tables(0 ).RowDeleted, AddressOf
Row_Deleting
Private Shared Sub Row_Deleting(By Val sender As Object, _
ByVal e As DataRowChangeEv entArgs)
If MessageBox.Show ("Are you sure?", "", MessageBoxButto ns.YesNo) =
Windows.Forms.D ialogResult.No Then
e.Row.RejectCha nges()
End If
End Sub

Ken
----------------
"John" <Jo**@nospam.in fovis.co.uk> wrote in message
news:%2******** **********@tk2m sftngp13.phx.gb l...
Hi

When I press the delete button on the BindingNavigato r it deletes the
record without any warning. How can I add a warning dialog when the delete
button on the BindingNavigato r 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
BindingNavigato r. Do I need to change anything at that end?

Regards

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:e5******** *****@TK2MSFTNG P15.phx.gbl...
Hi,

I wish the bindingnavigato rdelete_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 AdventureWorksD ataSet.Tables(0 ).RowDeleted, AddressOf
Row_Deleting
Private Shared Sub Row_Deleting(By Val sender As Object, _
ByVal e As DataRowChangeEv entArgs)
If MessageBox.Show ("Are you sure?", "", MessageBoxButto ns.YesNo) =
Windows.Forms.D ialogResult.No Then
e.Row.RejectCha nges()
End If
End Sub

Ken
----------------
"John" <Jo**@nospam.in fovis.co.uk> wrote in message
news:%2******** **********@tk2m sftngp13.phx.gb l...
Hi

When I press the delete button on the BindingNavigato r it deletes the
record without any warning. How can I add a warning dialog when the
delete button on the BindingNavigato r 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.in fovis.co.uk> wrote in message
news:e5******** ******@TK2MSFTN GP11.phx.gbl...
Doesn't seem to work for me. The msgbox never appears. I am using the
BindingNavigato r. Do I need to change anything at that end?

Regards

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:e5******** *****@TK2MSFTNG P15.phx.gbl...
Hi,

I wish the bindingnavigato rdelete_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 AdventureWorksD ataSet.Tables(0 ).RowDeleted, AddressOf
Row_Deleting
Private Shared Sub Row_Deleting(By Val sender As Object, _
ByVal e As DataRowChangeEv entArgs)
If MessageBox.Show ("Are you sure?", "", MessageBoxButto ns.YesNo) =
Windows.Forms.D ialogResult.No Then
e.Row.RejectCha nges()
End If
End Sub

Ken
----------------
"John" <Jo**@nospam.in fovis.co.uk> wrote in message
news:%2******** **********@tk2m sftngp13.phx.gb l...
Hi

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

Thanks

Regards



Nov 21 '05 #4
Hi,

Try this instead. In the designer set the bindingnavigato rs
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
BindingNavigato rDeleteItem_Cli ck event open. Add the code below to control
the delete.

Private Sub BindingNavigato rDeleteItem_Cli ck(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
BindingNavigato rDeleteItem.Cli ck
If MessageBox.Show ("Are you sure?", "", MessageBoxButto ns.YesNo) =
Windows.Forms.D ialogResult.Yes Then
ContactBindingS ource.RemoveCur rent()
End If
End Sub


Ken

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

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

Regards

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:e5******** *****@TK2MSFTNG P15.phx.gbl...
Hi,

I wish the bindingnavigato rdelete_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 AdventureWorksD ataSet.Tables(0 ).RowDeleted, AddressOf
Row_Deleting
Private Shared Sub Row_Deleting(By Val sender As Object, _
ByVal e As DataRowChangeEv entArgs)
If MessageBox.Show ("Are you sure?", "", MessageBoxButto ns.YesNo) =
Windows.Forms.D ialogResult.No Then
e.Row.RejectCha nges()
End If
End Sub

Ken
----------------
"John" <Jo**@nospam.in fovis.co.uk> wrote in message
news:%2******** **********@tk2m sftngp13.phx.gb l...
Hi

When I press the delete button on the BindingNavigato r it deletes the
record without any warning. How can I add a warning dialog when the
delete button on the BindingNavigato r 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***@bellsout h.net> wrote in message
news:ea******** ******@TK2MSFTN GP12.phx.gbl...
John,

Are you binding to a dataset?

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

Regards

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:e5******** *****@TK2MSFTNG P15.phx.gbl...
Hi,

I wish the bindingnavigato rdelete_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 AdventureWorksD ataSet.Tables(0 ).RowDeleted, AddressOf
Row_Deleting
Private Shared Sub Row_Deleting(By Val sender As Object, _
ByVal e As DataRowChangeEv entArgs)
If MessageBox.Show ("Are you sure?", "", MessageBoxButto ns.YesNo)
= Windows.Forms.D ialogResult.No Then
e.Row.RejectCha nges()
End If
End Sub

Ken
----------------
"John" <Jo**@nospam.in fovis.co.uk> wrote in message
news:%2******** **********@tk2m sftngp13.phx.gb l...
Hi

When I press the delete button on the BindingNavigato r it deletes the
record without any warning. How can I add a warning dialog when the
delete button on the BindingNavigato r 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
7271
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 clicks delete I want to show a message box that says are you sure, and then stop the delete if the user wants to. I've places a messagebox.show in rowdeleteing, but when you say no, it deletes anyway. Where can I trap the delete and stop it?
3
9663
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 attempt failed. In the Visual Designer I added a BindingSource bs, then a BindingNavigator bn, and assigned bs to the BindingSource property of bn. In code, I generate my XmlDocument, massage it to fit into a DataSet, then assign it to the...
0
1806
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 sets and bindingsources etc have been aded programatically Any ideas? Peter
7
27834
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 tableBindingSource. There is also an associated BindingNavigator. The table's primary key is a field called 'who'. I have a valid value for 'who' and want to set the Navigator to the record that contains this value so the fields are displayed in the associated...
2
1431
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 I want to know what command and line of C# I must add to my program to generate the new ID when I clicked the “add new” button IF I want to have 1 bindingnavigator control for both of them. Thank you
0
1445
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 changed to reflect the new BindingSource. I want to trap an event for this change (BindingSourceChanged), but I can't find anything.
0
1090
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 i run the form the bindingnavigator seems to be disabled. I can quite clearly the bindingnavigator when the form is run, but the buttons cannot be pressed. I also have on this form a textbox. The databinding property value of this
1
1761
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, since there is no record yet, a single row is displayed as a new row. when i click the row to enter data, the bindingnavigator count becomes 1 from 0. the delete bindingnavigator button becomes enabled. now what i will do is click the delete button...
0
3926
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" (bindingnavigatorAddNewItem_Click) programmatically. Indeed, rather than either the user who clicks on this button, I will like to call it programmatically. What I do is: bindingNavigator.BindingSource = bindingSource; ... ... ...
0
8474
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8392
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8912
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8597
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7428
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5692
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4403
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2049
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.