VB.NET Inheritance with Forms in Visual Basic .NET
In this article, I will explain you about Inheritance with Forms in Visual Basic .NET.
In Visual Basic .NET when we want to inherit a class from existing class we use Inheritance. Same as we inherit a class from existing class we can inherit a form from existing form. I show you how we can inherit a new form from an existing form. Suppose we have a Form1 with some controls and we want to derive those controls in a new form from that Form1. For this select Project->Add New Items from the main menu.
By this you open the Add New Item Window. In this window select Windows Forms then selectInherited Form and click on Add button to add inherited form in your Application.
When you click on add button Inheritance Picker Window will be opened. It looks like the image below:
Select Form1 in the picker and click OK. When you click OK new form, Form2 which is derived from Form1 is opened. Everything on Form2 is same as Form1 even the name is also same. The only difference between Form1 and Form2 is that every control on Form2 have the icon. That indicates that the form is inherited from other form and the derived controls are locked. It looks like the image below:
I hope this article help you to understand about Inheritance with Forms in Visual Basic .NET.