About the inheritance of the class

xiaoxiao2021-03-06  64

I inherited a control, 1. In the Overrides, there is an onclick event, in the control's event, there is a Click event, what is the difference between these two events? 2, if I wrote the code in the event click, then when I inherited this control, in myctrl.click event, I wrote Code, when I executed, the two codes were executed. If, I want to do the code you wrote in my inheritance control, only execute the code in the control, how do I write in the base class? There is also a problem, that is, the passage of the event, there is no such article in this regard.

Thank you! Test: 1. Write the code in Protected Overrides Sub Onclick (Byval E ASTEM.EventArgs), will be used in the use of the control, instead of executive subcomponent1_click (ByVal Sender As Object, Byval E as System.EventArgs) Handles mybase.click and Private Sub Component1_click using this control, so if you do not write code in Protected Overrides Sub Onclick (ByVal E ASTEM.EventArgs, the Click event of the control will be shielded. 2. After removing Protected Overrides Sub Onclick (Byval E AS System.Eventargs), the order in turn is: private subcomponent1_click (Byval eVal e as system.eventargs) Handles mybase.click (in inheritance control), Then: Use the private subponent1_click of the control. It can be seen that the passage of the event is to perform the control in the control, and execute the code in the use of the control.

转载请注明原文地址:https://www.9cbs.com/read-86003.html

New Post(0)