Hi,
I'm writing a C# program (using Visual Studio 2005 Professional
Edition).
I have defined a class MyPanel in the following way:
class MyPanel : Panel
{
...
}
In this class I have put a btn Button control, and I have defined the
event handler:
btn.Click += new EventHandler(btn_Click);
...
void btn_Click(object sender, EventArgs e)
{
...
}
Then, I have defined another class, inherited from MyPanel:
class MyPanel2 : MyPanel
In this class I would like to enrich the btn_Click event handler (the
code of the base class should be executed anyway), but I don't know
why...
If it were a method, as for example
protected void InitializeControls()
{
...
}
in the inherited class I could write:
protected override void InitializeControls()
{
base.InitializeControls();
...
}
but if I want to enrich an event handler and not a method, how can I
do? (I have tried to add the "protected" keyword in the event
handler definition of MyPanel base class:
protected void btn_Click(object sender, EventArgs e)
{
...
}
but when I go in the inherited class and try to write "protected
override", the methods list the compiler shows me doesn't include
this event handler...
Can you give me any suggestion about that?
Thank you very much