Results 1 to 10 of 10

Thread: [2005] Delete warning with bindingnavigator problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    11

    [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:
    1. Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
    2.  
    3. ''Delete current record after confirming.
    4. 'Dim deleteDialogResult As DialogResult
    5. 'Dim test As New System.ComponentModel.CancelEventArgs
    6. 'With Me
    7.  
    8. ' If .BindingNavigatorDeleteItem.Text = "&Delete" Then
    9. ' deleteDialogResult = MessageBox.Show("Delete this record?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
    10. ' If deleteDialogResult = Windows.Forms.DialogResult.No Then
    11. '
    12. ' MessageBox.Show("No Deletion Screen will close", "No Deletion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    13. ' 'Me.Close()
    14. ' e.EventsArgs.RejectChanges()
    15.  
    16. ' End If
    17. ' End If
    18. 'End With
    19. end sub

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [2005] Delete warning with bindingnavigator problem

    Why is everything commented out?

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    11

    Re: [2005] Delete warning with bindingnavigator problem

    vb.net Code:
    1. Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
    2.  
    3.         'Delete current record after confirming.
    4.         Dim deleteDialogResult As DialogResult
    5.         'Dim test As New System.ComponentModel.CancelEventArgs
    6.         With Me
    7.  
    8.             If .BindingNavigatorDeleteItem.Text = "&Delete" Then
    9.                 deleteDialogResult = MessageBox.Show("Delete this record?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
    10.                 If deleteDialogResult = Windows.Forms.DialogResult.No Then
    11.  
    12.                     MessageBox.Show("No Deletion Screen will close", "No Deletion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    13.                     'Me.Close()
    14.  
    15.                 End If
    16.             End If
    17.         End With
    18.     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

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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?

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    11

    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

  6. #6
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    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.

  7. #7

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    11

    Re: [2005] Delete warning with bindingnavigator problem

    i tried stepping through it i need like a code to stop the process

  8. #8
    Fanatic Member onlyGirl's Avatar
    Join Date
    Sep 2006
    Location
    Houston, TX
    Posts
    743

    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.

  9. #9

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    11

    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

  10. #10
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: [2005] Delete warning with bindingnavigator problem

    vb Code:
    1. Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, _
    2.                                              ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
    3.     If Me.BindingNavigatorDeleteItem.Text = "&Delete" Then
    4.         If MessageBox.Show("Delete this record?", _
    5.                            "Confirm Delete", _
    6.                            MessageBoxButtons.YesNo, _
    7.                            MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
    8.             'if no, do something
    9.         Else
    10.             'If yes, do something else
    11.         End If
    12.     End If
    13. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width