vb.netwinformsinheritancecontrolsmultipage

Can a Form inherit controls from parent form in VB.NET?


I'm a beginner in Visual Studio and i'm developing a WinForm using VB.NET. I would like to have child forms to inherit controls as menu strips or tool strips without creating the same ones over and over as i pass to other forms.

In old VBA i could do that with multipage, just changing the bottom part of the form without touching the rest, but is that possible in Visual Studio? As previously said i'm a beginner so i hope in detailed answers.


Solution

    1. Add a new form.
    2. Click the Show All Files button in the Solution Explorer.
    3. Expand the node for the form.
    4. Open the designer code file.
    5. Edit the Inherits line to inherit your desired base form instead of the standard Form class.

    That's all there is to it. Inheritance works the same way all the time.