ArticleDirectory
- Inherit the form programmatically
Creating a Windows form by inheriting from the base form is a quick way to repeat the best results, instead of creating a new form from the beginning each time you need it.
For more information about using the inheritance selector dialog box during design to inherit the form and how to visually distinguish the security level of the inherited control, see .
Note that to inherit from a form, the file or namespace containing the form must have been compiled into an executable file or DLL. To compile a project, select "compile" from the "compile" menu ". References to the namespace must also be added to the class that inherits the form. The displayed dialog box and menu command may be different from the description in "help", depending on your current settings or version. To change the settings, select "Import and Export Settings" from the "Tools" menu ". For more information, see .
Inherit the form programmatically
In the class, add a reference to the namespace, which contains the form to inherit from.
In the class definition, add the reference to the form to inherit from. The reference should include the namespace containing the form, followed by a period, followed by the name of the base form itself.