I want use a different signature for a base class event and also override the
On... protected method. It's not working. What am I doing wrong? Here's
the code.
public partial class UCBase : UserControl
{
public event EventHandler IWasClicked;
public UCBase()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.OnIWasClicked(EventArgs.Empty);
}
protected virtual void OnIWasClicked(EventArgs e)
{
if (this.IWasClicked != null)
this.IWasClicked(this, e);
}
}
public partial class UCSpecial : UCBase
{
public new event CancelEventHandler IWasClicked;
public UCSpecial()
{
InitializeComponent();
}
protected override void OnIWasClicked(EventArgs e)
{
this.OnIWasClicked(CancelEventArgs.Empty);
}
protected virtual void OnIWasClicked(CancelEventArgs e)
{
MessageBox.Show("UCSpecial before raising the event.");
if (this.IWasClicked != null)
this.IWasClicked(this, e);
}
}
--
Willy