Hi all.. Good Day.
i have problem with form inheritance... i have 2 form in my application. Second form inherited from First form. i placed 1 button in first form...
I wand to write some code that should work while i'm click second form.... second form button that inherited from first form....
in second form wer i can write my code... ??
thanks....
Form Inheritance
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Kirtan PatelRank #292 · 8.6K reputationPosted Jul 31, 2009, 10:51 AM EDT
public virtual void button1_Click(Object Sender, EventArgs e)
{
MessageBox.Show("Called Function of Form1");
}
//In form 2 Override that method to implement new functionality to button like below
public override void button1_Click(object Sender, EventArgs e)
{
MessageBox.Show("This Is From Form2");
}
now when you click button from Form1 It Will Execute the Form1's Click Event and When you Click it From Form 2 it will Execute Overridden Method
Happy Coding :)
Shouketh EK36 reputationPosted Aug 2, 2009, 9:42 PM EDT
good day.
thank you for u'r help. this is very usefull for me. And i solved this problem trough event.