C# : form Inheritance

  • Thread starter Thread starter RD
  • Start date Start date
R

RD

I created a base form with couple of buttons and wrote some code in the
button_click.

Then I inherited this form and created another one .
But I am not able to add more code into the button_click in the new form
(or I am not able to see the code).

Is it possible? If so how?

Thanks
 
the code that you put is there, it just doesnt show because its hidden
(polymorphism?).
if you add new code it iwll execute the code you put in the original and the
new one.

if i undrestand your question right then thats the answer.
 
Still I have doubts.
Base code is not showing because of "Polymorphism". That part is clear
now.

But I am not able to see the "button_click()" module to write more code
into it (in the new form) .
Do I have to do any property setting to see the module?

Thanks
 
RD said:
Still I have doubts.
Base code is not showing because of "Polymorphism". That part is clear
now.

But I am not able to see the "button_click()" module to write more code
into it (in the new form) .
Do I have to do any property setting to see the module?

It's not a module - it's a method. You can't just "write more code into
it" - but what you *can* do (if it's a virtual method) is override it,
and call the base version either at the start or the end of your
method.
 
Just to make sure, the button event isn't private is it?
If so it needs to be protected or public.
 
Back
Top