none
Button Triggers Additional Method RRS feed

  • Question

  • Hello,

    Today, after deleting some panels from my Windows Forms Application, my buttons no longer trigger events. After clicking on the button, it does not jump to its previous method, but to a new one. This would look like this:

     Private Sub Button23_Click_1(sender As Object, e As EventArgs) Handles Button23.Click
    
        End Sub

    However, it used to be like this:

     Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click
    ''whatever i want to do
        End Sub

    How can I fix this without pasting in every old function? I have many, many controls on many, many forms, and it would take entire days to restore it to its old state.

    Thank you!

    Wednesday, December 12, 2018 3:02 PM

Answers

  • Yes, they were deleted, but I just cut them out and then pasted them again. So, they are the same.
    Once you delete them the event subscriptions are null and void which is why you are getting another event.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by Jakob60124 Thursday, December 13, 2018 12:18 AM
    Wednesday, December 12, 2018 7:22 PM
    Moderator
  • Yes, they were deleted, but I just cut them out and then pasted them again. So, they are the same.

    A lesson learned huh.  The next time move the button(s) out of the panel you want to delete and after deleting the panel reposition them.  A lot of us have made this mistake so don't feel bad.


    "Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it."

    - from former MSDN User JohnWein

    SerialPort Info

    Multics - An OS ahead of its time.

    • Marked as answer by Jakob60124 Thursday, December 13, 2018 12:18 AM
    Wednesday, December 12, 2018 9:54 PM

All replies

  • Hello,

    Today, after deleting some panels from my Windows Forms Application, my buttons no longer trigger events. After clicking on the button, it does not jump to its previous method, but to a new one. This would look like this:

     Private Sub Button23_Click_1(sender As Object, e As EventArgs) Handles Button23.Click
    
        End Sub

    However, it used to be like this:

     Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click
    ''whatever i want to do
        End Sub

    How can I fix this without pasting in every old function? I have many, many controls on many, many forms, and it would take entire days to restore it to its old state.

    Thank you!


    Where the buttons in the panels that were deleted?

    "Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it."

    - from former MSDN User JohnWein

    SerialPort Info

    Multics - An OS ahead of its time.

    Wednesday, December 12, 2018 3:50 PM
  • Yes, they were deleted, but I just cut them out and then pasted them again. So, they are the same.
    Wednesday, December 12, 2018 6:53 PM
  • Yes, they were deleted, but I just cut them out and then pasted them again. So, they are the same.
    Once you delete them the event subscriptions are null and void which is why you are getting another event.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by Jakob60124 Thursday, December 13, 2018 12:18 AM
    Wednesday, December 12, 2018 7:22 PM
    Moderator
  • Yes, they were deleted, but I just cut them out and then pasted them again. So, they are the same.

    Once you delete them the event subscriptions are null and void which is why you are getting another event.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    So, that means that I cannot restore their methods? I will mark your reply as an answer, should this be the case. Thank you!
    Wednesday, December 12, 2018 7:53 PM
  • Yes, they were deleted, but I just cut them out and then pasted them again. So, they are the same.

    A lesson learned huh.  The next time move the button(s) out of the panel you want to delete and after deleting the panel reposition them.  A lot of us have made this mistake so don't feel bad.


    "Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it."

    - from former MSDN User JohnWein

    SerialPort Info

    Multics - An OS ahead of its time.

    • Marked as answer by Jakob60124 Thursday, December 13, 2018 12:18 AM
    Wednesday, December 12, 2018 9:54 PM