|
-
Oct 31st, 2007, 01:29 PM
#1
Thread Starter
New Member
[2005] Delete warning with bindingnavigator problem
Delete warning with bindingnavigator
When i press the delete button it comes up with prompt do i want to delete but if i click no it deletes anyway here is my code
vb.net Code:
Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
''Delete current record after confirming.
'Dim deleteDialogResult As DialogResult
'Dim test As New System.ComponentModel.CancelEventArgs
'With Me
' If .BindingNavigatorDeleteItem.Text = "&Delete" Then
' deleteDialogResult = MessageBox.Show("Delete this record?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
' If deleteDialogResult = Windows.Forms.DialogResult.No Then
'
' MessageBox.Show("No Deletion Screen will close", "No Deletion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
' 'Me.Close()
' e.EventsArgs.RejectChanges()
' End If
' End If
'End With
end sub
-
Oct 31st, 2007, 01:39 PM
#2
Re: [2005] Delete warning with bindingnavigator problem
Why is everything commented out?
-
Oct 31st, 2007, 01:47 PM
#3
Thread Starter
New Member
Re: [2005] Delete warning with bindingnavigator problem
vb.net Code:
Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
'Delete current record after confirming.
Dim deleteDialogResult As DialogResult
'Dim test As New System.ComponentModel.CancelEventArgs
With Me
If .BindingNavigatorDeleteItem.Text = "&Delete" Then
deleteDialogResult = MessageBox.Show("Delete this record?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If deleteDialogResult = Windows.Forms.DialogResult.No Then
MessageBox.Show("No Deletion Screen will close", "No Deletion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
'Me.Close()
End If
End If
End With
End Sub
sorry about that i am working right tryin to figure it out
Last edited by Hack; Oct 31st, 2007 at 01:54 PM.
Reason: Added highlight tags
-
Oct 31st, 2007, 01:56 PM
#4
Re: [2005] Delete warning with bindingnavigator problem
I added [highlight=vb.net]your code goes in here[/highlight] tags to your post. When posting code, if you use these, it will be much easier to read. 
I don't see any code doing any deleting. Just asking the question. Did that get removed somehow?
-
Oct 31st, 2007, 02:31 PM
#5
Thread Starter
New Member
Re: [2005] Delete warning with bindingnavigator problem
well it generates itself from when i added the database to the form it gave me the bindingnavigation tools add delete and save when i click add it just add it on its own when i click delete it deletes i just put the prompt in askin if you want to delete or not and im tryin to cancel keep it from deleting
-
Oct 31st, 2007, 03:10 PM
#6
Fanatic Member
Re: [2005] Delete warning with bindingnavigator problem
have you tried stepping through your code to see what is going on?
Using Visual Studio 2008
Please mark your thread RESOLVED if you no longer need help.
-
Nov 1st, 2007, 01:01 PM
#7
Thread Starter
New Member
Re: [2005] Delete warning with bindingnavigator problem
i tried stepping through it i need like a code to stop the process
-
Nov 1st, 2007, 01:10 PM
#8
Fanatic Member
Re: [2005] Delete warning with bindingnavigator problem
so at which line does it get stuck on?
Using Visual Studio 2008
Please mark your thread RESOLVED if you no longer need help.
-
Nov 2nd, 2007, 11:17 AM
#9
Thread Starter
New Member
Re: [2005] Delete warning with bindingnavigator problem
it really not getting stuck on no line it just going through the process it pops up the message box click yes or no i click no it stills delete the only way it doesnt delete it is if i have me.close but i dont want it to close the form
-
Nov 2nd, 2007, 09:51 PM
#10
PowerPoster
Re: [2005] Delete warning with bindingnavigator problem
vb Code:
Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
If Me.BindingNavigatorDeleteItem.Text = "&Delete" Then
If MessageBox.Show("Delete this record?", _
"Confirm Delete", _
MessageBoxButtons.YesNo, _
MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
'if no, do something
Else
'If yes, do something else
End If
End If
End Sub
Last edited by BrailleSchool; Nov 2nd, 2007 at 09:58 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|