Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
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
Handlesclause 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 SubIf the inherited method does not have a
Handleskeyword, verify that your code does not contain an extra AddHandler Statement or any additional methods that handle the same event.