O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Use Form Inheritance

Problem

You want to create and apply a consistent template to multiple forms.

Solution

Create a base form class, and derive all other forms from this class.

Discussion

Using inheritance with form classes is just as straightforward as using it with any other type of control class. You can use it to standardize visual appearance for multiple similar windows (for example, in a wizard) or in similar windows in multiple applications.

To use form inheritance, follow these three steps:

  1. Create a base form, and configure as you would any other form.

  2. Compile the project.

  3. Create a derived form.

There are two approaches to create your derived form. You can create it automatically with Visual Studio .NET by right-clicking the project item in Solution ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required