Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 2 - Inheritance and Windows Forms
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Inheritance and Windows Forms
By: Mohammed Qattan
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 25
    2004-01-26

    Table of Contents:
  • Inheritance and Windows Forms
  • Exploring Forms
  • Validating Inputs
  • Carrying Out the Scenario
  • Explanation

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Inheritance and Windows Forms - Exploring Forms


    (Page 2 of 5 )

    Now let’s explore the “Forms” folder in under the project. As you can see, there are three forms: “ManageEmployees”, “ManageManagers”, and “ManageTechnicians”. If you view the code in the “ManageManagers” or the “ManageTechnicians” forms, then you will see that these forms inherit from the “ManageEmployees” form.

    Here is how we add an inherited form.

    1) Right click on the project and select “Add” -> “Add Windows Form”, and name it “ManageEmployees”

    2) Before adding the inherited form, make sure you “Build” the project.

    3) Right click on the project and select “Add” -> “Add Inherited Form”, and name it “ManageManagers”. In the “Inherit Picker” chose the form that we want to inherit from , and in this case it is “ManageEmployees”
    4) Do the same step for the form “ManageTechnicians”.

    What we have done so far is the following:

    1) We added classes “Manager” and “Technician”, which inherit from the “Employee” Class.

    2) We added forms “ManageManagers” and “ManageTechnicians”, which inherit from the “ManageEmployees”.

    Now, here is the beauty of the inheritance in windows form. We will be working on the “ManageEmployees” form only, and this will be reflected on the other forms since we have the inheritance relation (remember?).

    1) Let’s set some properties on the “ManageEmployees” form:
        a. ControlBox = False
        b. FormBorderStyle = FixedDialog.
    2) Add 2 labels to the form (lblName, lblAge).
    3) Add 2 text boxes to the form (txtName, txtAge).
    4) Add a button (btnAdd).
    5) And finally add an Error Provider (errProvider).

    If you want to set the properties of the controls on the form, then please check them on the project.

    Before we move on, please make sure to “Build” the project. If you check the “ManageManagers” or the “ManageTechnicians” forms, you will find out that they have the same properties and the controls that are available on the “ManageEmployees” form. No magic was done, it is the inheritance.

    More Visual Basic.NET Articles
    More By Mohammed Qattan


     

    VISUAL BASIC.NET ARTICLES

    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...
    - Creating and Drawing a Game Map in VB.NET (F...
    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT