I would like to rewrite the textbox.click event.
But I cannot find the correct stuff on this matter, is it call
override?
Please give me some hints, Thanks!
Armin Zingler - 27 Feb 2008 01:46 GMT
> I would like to rewrite the textbox.click event.
> But I cannot find the correct stuff on this matter, is it call
> override?
> Please give me some hints, Thanks!
What does "rewrite" mean? The Textbox raises the event in the OnClick
method (inherited from Control). You can override this method. Usually
the overriden method is called first:
Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
MyBase.OnClick(e)
End Sub
Armin
Cor Ligthert[MVP] - 27 Feb 2008 05:53 GMT
Cylix-
I am curious why (and for what) you want to do this, we want to learn here
you know.
-Cor
>I would like to rewrite the textbox.click event.
> But I cannot find the correct stuff on this matter, is it call
> override?
> Please give me some hints, Thanks!
Cylix - 03 Mar 2008 07:13 GMT
> I am curious why (and for what) you want to do this, we want to learn here
> you know.
No special usage actually, just would like to know is any method to do
so.
And, it looks easy.
Thanks all.
Phill W. - 27 Feb 2008 11:59 GMT
> I would like to rewrite the textbox.click event.
A questionable motive, but the principle's the same for all the events,
so here goes ...
Derive a custom TextBox class from the standard one, and override (or,
in the case, "extend" (/my/ term)) the processing for "Click" :
Class CustomTextBox
Inherits TextBox
Public Sub New()
End Sub
Protected Overrides Sub OnClick( _
e as EventArgs _
)
' Do some custom things here
' . . .
' Get the Click event raised to anyone /else/ who might be
' listening out for it
MyBase.OnClick( e )
' Do some more custom things here
' . . .
End Sub
HTH,
Phill W.