I have a form with a custom control in it. That control has an event handler on the ItemChanged event.
private void ncNomSimple_ItemChanged(object sender, EventArgs e)
{
some code..
}
I inherit this form, thus I have the control and the event in my new form but I want another event handler in my new form to be called for that event, not the above one. How can I achieve this?
In the base class:
protected virtual void ncNomSimple_ItemChanged(object sender, EventArgs e)
{
MessageBox.Show("called from Test class");
}
In the derived class:
protected override void ncNomSimple_ItemChanged(object sender, EventArgs e)
{
MessageBox.Show("called from Test1 class");
}
Change the event handler from private to protected virtual and override it in the inherited form.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With