Troubleshooting Inherited Event Handlers in Visual Basic
This topic lists common issues that arise with event handlers in inherited components.
Procedures
Code in Event Handler Executes Twice for Every Call
An inherited event handler must not include a Handles clause. The method in the base class is already associated with the event and will fire accordingly. Remove the
Handles
clause from the inherited method.' INCORRECT Protected Overrides Sub Button1_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' The Handles clause will cause all code ' in this block to be executed twice. End Sub
If the inherited method does not have a
Handles
keyword, verify that your code does not contain an extra AddHandler Statement or any additional methods that handle the same event.
See also
Samarbejd med os på GitHub
Kilden til dette indhold kan findes på GitHub, hvor du også kan oprette og gennemse problemer og pullanmodninger. Du kan få flere oplysninger i vores vejledning til bidragydere.
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om