Form Inheritance

Discussion in 'Microsoft Dot NET Framework Forms' started by HJ Rodirguez, Jan 29, 2004.

  1. HJ Rodirguez

    HJ Rodirguez Guest

    Hello All,

    I have created a base form (frmMDIChild) from which I would like to
    inherit all future forms from.

    The base form has 3 properties which I would like to enforce on all
    forms which inherit from the base form.

    Me.Icon = CType(resources.GetObject("$this.Icon"),
    System.Drawing.Icon)
    Me.MinimizeBox = False
    Me.ShowInTaskbar = False

    I would like to make so that the forms which inherit from my base form
    can not change these properties.

    Thanks in advance for your help.

    HJ


    Below is the code for my base class
    -----------------------------------------------------------------------------
    Public MustInherit Class frmMDIChild
    Inherits System.Windows.Forms.Form

    #Region " Windows Form Designer generated code "

    Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As
    Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form
    Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub
    InitializeComponent()
    Dim resources As System.Resources.ResourceManager = New
    System.Resources.ResourceManager(GetType(frmMDIChild))
    '
    'frmMDIChild
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(384, 302)
    Me.Icon = CType(resources.GetObject("$this.Icon"),
    System.Drawing.Icon)
    Me.MinimizeBox = False
    Me.ShowInTaskbar = False
    Me.Name = "frmMDIChild"
    Me.Text = "frmMDIChild"

    End Sub

    #End Region

    End Class
    -----------------------------------------------------------------------------
     
    HJ Rodirguez, Jan 29, 2004
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nancy

    Form Inheritance controls Issue

    Nancy, Jul 16, 2003, in forum: Microsoft Dot NET Framework Forms
    Replies:
    1
    Views:
    465
  2. Nancy Zamora

    Re: Form Inheritance controls Issue

    Nancy Zamora, Jul 16, 2003, in forum: Microsoft Dot NET Framework Forms
    Replies:
    1
    Views:
    477
    Mark Lam
    Jul 16, 2003
  3. David

    form inheritance and access modifier

    David, Jul 17, 2003, in forum: Microsoft Dot NET Framework Forms
    Replies:
    0
    Views:
    493
    David
    Jul 17, 2003
  4. Donald Adams

    Form Inheritance calling public method problem.

    Donald Adams, Sep 30, 2003, in forum: Microsoft Dot NET Framework Forms
    Replies:
    0
    Views:
    177
    Donald Adams
    Sep 30, 2003
  5. Michael Reimann

    PRB: Combobox inheritance and Form designer

    Michael Reimann, Oct 13, 2003, in forum: Microsoft Dot NET Framework Forms
    Replies:
    3
    Views:
    355
    Ying-Shen Yu[MSFT]
    Oct 15, 2003
Loading...

Share This Page