SunQuest
 
       VB.Net
  Home arrow VB.Net arrow Page 4 - Everything You Wanted to Know About Forms ...
IBM developerWorks
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
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? 
VB.NET

Everything You Wanted to Know About Forms Inheritance in VB.Net
By: Saurabh Verma
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 175
    2003-10-29

    Table of Contents:
  • Everything You Wanted to Know About Forms Inheritance in VB.Net
  • Concept of Inheritance
  • Visual Inheritance
  • What’s New in This Article
  • What's New in This Article, Cont'd
  • Conclusion

  • 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

    AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th -1:00PM EST. Register Today!

    Everything You Wanted to Know About Forms Inheritance in VB.Net - What’s New in This Article


    (Page 4 of 6 )

    If you simply inherit the form, you will not be able to change the properties of the Controls which you have placed in the base form. This example covers:

    1. How to inherit the form
    2. How make custom properties
    3. How to use the custom properties from the Child form
    4. How you change the properties of the controls from the parent form, which are not in the parent form (i.e. they are in the Child forms)
    5. How to override the functionality of the Parent form from the Child Form
    6. How to change the properties of the inherited controls at design time (i.e. how to reposition the controls, set different properties, etc.)

    1) How to inherit the form

    Open the child form and replace the ChildForm’s Inherits line to <name of the parent form> from <System.Windows.Forms.Form>

    Base Form:
    Public Class PMainForm
        Inherits System.Windows.Forms.Form

    Child Forms:
    Public Class ChildForm
        Inherits PmainForm

    2) How to make custom properties

    Open the Parent Form and create a property (having a scope as Protected Friend)

        'CurrentPosition Property
        Dim LPosition As Long
        Protected Property Position() As Long
            Get
                Return LPosition
            End Get
            Set(ByVal Value As Long)
                LPosition = Value
            End Set
        End Property

    3) How to use the custom properties from the Child form

    Open the child Form. Use Me.<propertyName> to change the property. For example, we are changing the property in the Load event of the child form.

    Private Sub CForm3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.Position = 99
    End Sub

    More VB.Net Articles
    More By Saurabh Verma


     

    VB.NET ARTICLES

    - MyClass - Implementing Polymorphism in VB.Net
    - Building a News Ticker Using VB.Net
    - Everything You Wanted to Know About Forms In...
    - Building Assemblies with VB.Net
    - Simple VB.NET Notify Icon with Panel Applica...
    - Regular Expressions in .NET
    - String Encryption With Visual Basic .NET
    - Deploying Applications in VB.NET: Part 1/2
    - Watching Folder Activity in VB.NET
    - Creating A Windows Service in VB.NET
    - Implementing The Google Web Service In VB.NET
    - Migrating to Visual Basic.NET from Visual Ba...







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