Hi, regards to everyone... I have some doubts about event handlers. I'm creating a version of the control Textbox that inherits it (in C#). My intention is validate the input of the custom textbox at the time of typing and some other features like select all the text when the control gets the focus. Here's come my confusion, to handle for example the event Enter i'm doing this:
this.Enter += new EventHandler(MyTextBox_Enter);
and then
protected void MyTextBox_Enter(object sender, EventArgs e){ //Do the work}
But, i realize that i could do it too by overriding the event of the base class:
protected override void OnEnter(EventArgs e){ //Do the work}and the same could say with the others event, keypress, lostfocus, etc...
So, which approach is the good one, or when use one or the another?? In the documentation that i've seen don't tell much and some code examples around the Internet use the former approach and some the last, but don't explain why they did it in such way.
Thanks...