JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using Visual Inheritance between Forms

As you know, inheritance allows you to derive one class from another. Visual Basic even provides a visual way of deriving one form from another. To see how this works, create a new Windows application and add a button to Form1. Then select the Build|Build menu item to build the project; this makes Form1 available for inheritance.

To derive a form from Form1—which will inherit all aspects of Form1, including the button—select the Project|Add Inherited Form menu item, then double-click the Inherited Form icon in the Templates box to open the Inheritance Picker, as you see in Figure 4.23.

Click To expand
Figure 4.23: The Inheritance Picker.

Select Form1 in the Inheritance Picker, and click OK, adding a new form, Form2, derived from Form1, as you see in Figure 4.24. Note that even the title text, "Form1", was copied from Form1, and that there's a special icon at upper left in the button in this new form to indicate that this button is locked—because it's been inherited from Form1, it cannot be removed.

Click To expand
Figure 4.24: An inherited form.
Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor