I inherit a TextBox and override OnInit.
Protected Overrides Sub OnInit(e As EventArgs)
MyBase.OnInit(e)
' I'm adding a dynamic control to go along with my textbox here...
Controls.Add(Something)
End Sub
I have MyBase.OnInit (e) in the above example, but I have been using my control for some time without it since I forgot to put it there. This is what I usually do out of habit, so I never thought about my goal:
When overriding OnInit in a derived class, be sure to call the class OnInit base so that registered delegates receive the event.
I am a little confused that this is not clear to me, but my control works fine, so I just hoped that someone could give an example of what could create a problem.
source
share