Inherits from Base Form : Control Inheritance « GUI « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » GUI » Control InheritanceScreenshots 
Inherits from Base Form
Inherits from Base Form

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Configuration
Imports System.Resources
Imports System.Drawing
Imports System.Drawing.Drawing2D

Public Class BaseForm
    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 NothingThen
                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.
    Friend WithEvents menuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents fileExitMenuItem As System.Windows.Forms.MenuItem
    Protected WithEvents statusBar As System.Windows.Forms.StatusBar
    Friend WithEvents menuItem3 As System.Windows.Forms.MenuItem
    Friend WithEvents helpAboutMenuItem As System.Windows.Forms.MenuItem
    Friend WithEvents mainMenu1 As System.Windows.Forms.MainMenu
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Me.menuItem1 = New System.Windows.Forms.MenuItem()
        Me.fileExitMenuItem = New System.Windows.Forms.MenuItem()
        Me.statusBar = New System.Windows.Forms.StatusBar()
        Me.menuItem3 = New System.Windows.Forms.MenuItem()
        Me.helpAboutMenuItem = New System.Windows.Forms.MenuItem()
        Me.mainMenu1 = New System.Windows.Forms.MainMenu()
        Me.SuspendLayout()
        '
        'menuItem1
        '
        Me.menuItem1.Index = 0
        Me.menuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.fileExitMenuItem})
        Me.menuItem1.Text = "&File"
        '
        'fileExitMenuItem
        '
        Me.fileExitMenuItem.Index = 0
        Me.fileExitMenuItem.Text = "E&xit"
        '
        'statusBar
        '
        Me.statusBar.Location = New System.Drawing.Point(072)
        Me.statusBar.Name = "statusBar"
        Me.statusBar.Size = New System.Drawing.Size(17622)
        Me.statusBar.TabIndex = 1
        Me.statusBar.Text = "Ready"
        '
        'menuItem3
        '
        Me.menuItem3.Index = 1
        Me.menuItem3.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.helpAboutMenuItem})
        Me.menuItem3.Text = "&Help"
        '
        'helpAboutMenuItem
        '
        Me.helpAboutMenuItem.Index = 0
        Me.helpAboutMenuItem.Text = "&About..."
        '
        'mainMenu1
        '
        Me.mainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuItem1, Me.menuItem3})
        '
        'BaseForm
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(17694)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.statusBar})
        Me.Menu = Me.mainMenu1
        Me.Name = "BaseForm"
        Me.Text = "BaseForm"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub fileExitMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgsHandles fileExitMenuItem.Click
        Me.Close()
    End Sub

    Private Sub helpAboutMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgsHandles helpAboutMenuItem.Click
        MessageBox.Show("Message?""About")
    End Sub

End Class



Public Class EditorForm
    Inherits BaseForm

#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 NothingThen
                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.
    Friend WithEvents textBox1 As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Me.textBox1 = New System.Windows.Forms.TextBox()
        Me.SuspendLayout()
        '
        'statusBar
        '
        Me.statusBar.Location = New System.Drawing.Point(071)
        Me.statusBar.Text = "Text on a status bar"
        Me.statusBar.Visible = True
        '
        'textBox1
        '
        Me.textBox1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.textBox1.Multiline = True
        Me.textBox1.Name = "textBox1"
        Me.textBox1.Size = New System.Drawing.Size(17671)
        Me.textBox1.TabIndex = 2
        Me.textBox1.Text = "Text in a text box."
        '
        'EditorForm
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(17693)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.textBox1, Me.statusBar})
        Me.Name = "EditorForm"
        Me.Text = "EditorForm"
        Me.ResumeLayout(False)

    End Sub

#End Region

End Class


Public Class MainClass
    Shared Sub Main()
        Dim myform As Form = New EditorForm()
        Application.Run(myform)
    End Sub

End Class
           
       
Related examples in the same category
1.Add components to inherited formAdd components to inherited form
ww__w.___j__a_v_a_2_s__.__c_o___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.