Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create a base class with some fields and prorerties
and use it instead of widows Form. Any new forms I create should be
inherited from MyForm class. How can I do this?
Posted

1 solution

Look at the definition of MyForm in your project, and you'll see exactly how to do it.
 
Share this answer
 
Comments
mr.abzadeh 13-Apr-11 19:06pm    
It is the case when I want to subclass a single form but I want to add fields and properties to MyForm and to create forms inherited from MyForm and add controls to it in a generic way so that adding new form from IDE generate code such as this:

public class Form1: MyForm //instead of Form

This allows me to create instances of MyForm rapidly specialy when I create many different classes (forms) and access it's members or methods public of MyForm. Please notice that fields of different types of MyForm should have the same structure.

Is there anyway to do this?
Thanks for your interes and reply

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900