Add components to inherited 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.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » GUI » Control InheritanceScreenshots 
Add components to inherited form
Add components to inherited 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 ExplorerForm
    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 treeView1 As System.Windows.Forms.TreeView
    Friend WithEvents splitter1 As System.Windows.Forms.Splitter
    Friend WithEvents listView1 As System.Windows.Forms.ListView
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Dim ListViewItem1 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem(New System.Windows.Forms.ListViewItem.ListViewSubItem() {New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, "-Derives from BaseForm", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window, New System.Drawing.Font("Microsoft Sans Serif"8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)))}, -1)
        Dim ListViewItem2 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem(New System.Windows.Forms.ListViewItem.ListViewSubItem() {New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, "-Overrides Text property", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window, New System.Drawing.Font("Microsoft Sans Serif"8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)))}, -1)
        Dim ListViewItem3 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem(New System.Windows.Forms.ListViewItem.ListViewSubItem() {New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, "-Overrides Size property", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window, New System.Drawing.Font("Microsoft Sans Serif"8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)))}, -1)
        Dim ListViewItem4 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem(New System.Windows.Forms.ListViewItem.ListViewSubItem() {New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, "-Adds a TreeView control", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window, New System.Drawing.Font("Microsoft Sans Serif"8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)))}, -1)
        Dim ListViewItem5 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem(New System.Windows.Forms.ListViewItem.ListViewSubItem() {New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, "-Adds a Splitter control", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window, New System.Drawing.Font("Microsoft Sans Serif"8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)))}, -1)
        Dim ListViewItem6 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem(New System.Windows.Forms.ListViewItem.ListViewSubItem() {New System.Windows.Forms.ListViewItem.ListViewSubItem(Nothing, "-Adds a ListView control", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window, New System.Drawing.Font("Microsoft Sans Serif"8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)))}, -1)
        Me.treeView1 = New System.Windows.Forms.TreeView()
        Me.splitter1 = New System.Windows.Forms.Splitter()
        Me.listView1 = New System.Windows.Forms.ListView()
        Me.SuspendLayout()
        '
        'statusBar
        '
        Me.statusBar.Location = New System.Drawing.Point(0123)
        Me.statusBar.Size = New System.Drawing.Size(28022)
        Me.statusBar.Visible = True
        '
        'treeView1
        '
        Me.treeView1.Dock = System.Windows.Forms.DockStyle.Left
        Me.treeView1.ImageIndex = -1
        Me.treeView1.Name = "treeView1"
        Me.treeView1.Nodes.AddRange(New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Node0"), New System.Windows.Forms.TreeNode("Node1", New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Node4", New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Node5", New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("Node6")})})}), New System.Windows.Forms.TreeNode("Node2"), New System.Windows.Forms.TreeNode("Node3")})
        Me.treeView1.SelectedImageIndex = -1
        Me.treeView1.Size = New System.Drawing.Size(121123)
        Me.treeView1.TabIndex = 2
        '
        'splitter1
        '
        Me.splitter1.Location = New System.Drawing.Point(1210)
        Me.splitter1.Name = "splitter1"
        Me.splitter1.Size = New System.Drawing.Size(3123)
        Me.splitter1.TabIndex = 3
        Me.splitter1.TabStop = False
        '
        'listView1
        '
        Me.listView1.Dock = System.Windows.Forms.DockStyle.Fill
        Me.listView1.Items.AddRange(New System.Windows.Forms.ListViewItem() {ListViewItem1, ListViewItem2, ListViewItem3, ListViewItem4, ListViewItem5, ListViewItem6})
        Me.listView1.Location = New System.Drawing.Point(1240)
        Me.listView1.Name = "listView1"
        Me.listView1.Size = New System.Drawing.Size(156123)
        Me.listView1.TabIndex = 4
        Me.listView1.View = System.Windows.Forms.View.List
        '
        'ExplorerForm
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(280145)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.listView1, Me.splitter1, Me.treeView1, Me.statusBar})
        Me.Name = "ExplorerForm"
        Me.ResumeLayout(False)

    End Sub

#End Region

End Class


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

End Class
           
       
Related examples in the same category
1.Inherits from Base FormInherits from Base Form
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.