ARTICLE

Inheritance with Forms in Visual Basic .NET

Posted by Atul Chaudhary Articles | Windows Forms VB.NET January 06, 2011
In this article, I will explain you about Inheritance with Forms in Visual Basic .NET.
 
Reader Level:

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.

img1.gif

By this you open the Add New Item Window. In this window select Windows Forms then select Inherited Form and click on Add button to add inherited form in your Application.

img2.gif

When you click on add button Inheritance Picker Window will be opened. It looks like the image below:

img3.gif

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:

img4.gif 

Summary

I hope this article help you to understand about Inheritance with Forms in Visual Basic .NET.

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Team Foundation Server Hosting
Become a Sponsor