Form Inheritance

A

Alij

Hi,

I have a simple form with two TextBox controls and two Button controls. I
have inherited this form, but I am not sure how to add the event to this
child class when its button is clicked.

I appreciate any pointers on how to do this.

Thanks,

Alij
 
M

Michael Nemtsev [MVP]

Hello Alij,

Not quite understood what are you trying to reach.
You can use base. identificator to have access to your parent class

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


A> have a simple form with two TextBox controls and two Button
A> controls. I have inherited this form, but I am not sure how to add
A> the event to this child class when its button is clicked.
A>
 
A

Alij

Hi,

I figured out the problem. I had a base class and was trying to access a
private TextBox from the derived class. Had to change it to protected and I
could access the TextBox object and change its events -- this is whatI was
trying to ask.

Thank you!
Alij
 
K

Karthik

Dear Alij

Change control's MODIFIERS property to public or protected on Base from.
Build the project once again.
Now you can access the control from the child form.

Regards
Karthik.C
----------------------------------------------------------
Winners do not do different things. They do things differently.

Alij said:
Hi,

I figured out the problem. I had a base class and was trying to access a
private TextBox from the derived class. Had to change it to protected and
I could access the TextBox object and change its events -- this is whatI
was trying to ask.

Thank you!
Alij

Michael Nemtsev said:
Hello Alij,

Not quite understood what are you trying to reach.
You can use base. identificator to have access to your parent class

---
WBR, Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and
we miss it, but that it is too low and we reach it" (c) Michelangelo

A> have a simple form with two TextBox controls and two Button
A> controls. I have inherited this form, but I am not sure how to add
A> the event to this child class when its button is clicked.
A>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top