ARTICLE

GUI Application in VB.NET to create table Layout Panel

Posted by Brijesh Jalan Articles | Visual Basic 2010 August 09, 2010
In this article we will learn how to create GUI Application in vb.net
Reader Level:

Create a Table Layout Panel in vb.net

1.Open visual studio and create a project in vb.net

2.Use the following code in form1.vb

Imports System.Windows.Forms
Public Class FlowLayoutPanelTableLayoutPanel
    Public Shared Sub Main()
        Application.Run(New Form1)
    End Sub

End
Class
Partial
Public Class Form1
    Inherits System.Windows.Forms.Form
    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub
    'Required by the Windows Form Designer
    '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()
        Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel
        Me.FlowLayoutPanel1 = New System.Windows.Forms.FlowLayoutPanel
        Me.Button1 = New System.Windows.Forms.Button
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Button2 = New System.Windows.Forms.Button
        Me.Button3 = New System.Windows.Forms.Button
        Me.Button4 = New System.Windows.Forms.Button
        Me.Button5 = New System.Windows.Forms.Button
        Me.Button6 = New System.Windows.Forms.Button
        Me.Button7 = New System.Windows.Forms.Button
        Me.Button8 = New System.Windows.Forms.Button
        Me.Button9 = New System.Windows.Forms.Button
        Me.Button10 = New System.Windows.Forms.Button
        Me.Button11 = New System.Windows.Forms.Button
        Me.Button12 = New System.Windows.Forms.Button
        Me.Button13 = New System.Windows.Forms.Button
        Me.Button14 = New System.Windows.Forms.Button
        Me.Button15 = New System.Windows.Forms.Button
        Me.Button16 = New System.Windows.Forms.Button
        Me.Button17 = New System.Windows.Forms.Button
        Me.Button18 = New System.Windows.Forms.Button
        Me.TableLayoutPanel1.SuspendLayout()
        Me.FlowLayoutPanel1.SuspendLayout()
        Me.SuspendLayout()

        'TableLayoutPanel1
        '
        Me.TableLayoutPanel1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.TableLayoutPanel1.CellBorderStyle =
System.Windows.Forms.TableLayoutPanelCellBorderStyle.OutsetDouble
        Me.TableLayoutPanel1.ColumnCount = 2
        Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
        Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!))
        Me.TableLayoutPanel1.Controls.Add(Me.Button10, 0, 0)
        Me.TableLayoutPanel1.Controls.Add(Me.Button11, 1, 0)
        Me.TableLayoutPanel1.Controls.Add(Me.Button12, 0, 1)
        Me.TableLayoutPanel1.Controls.Add(Me.Button13, 1, 1)
        Me.TableLayoutPanel1.Controls.Add(Me.Button14, 0, 2)
        Me.TableLayoutPanel1.Controls.Add(Me.Button15, 1, 2)
        Me.TableLayoutPanel1.Controls.Add(Me.Button16, 0, 3)
        Me.TableLayoutPanel1.Controls.Add(Me.Button17, 1, 3)
        Me.TableLayoutPanel1.Controls.Add(Me.Button18, 0, 4)
        Me.TableLayoutPanel1.Location = New System.Drawing.Point(264, 16)
        Me.TableLayoutPanel1.Name = "TableLayoutPanel1"
        Me.TableLayoutPanel1.RowCount = 5
        Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20.0!))
        Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20.0!))
        Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20.0!))
        Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20.0!))
        Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20.0!))
        Me.TableLayoutPanel1.Size = New System.Drawing.Size(248, 173)
        Me.TableLayoutPanel1.TabIndex = 0
        '
        'FlowLayoutPanel1
        '
        Me.FlowLayoutPanel1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.FlowLayoutPanel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.FlowLayoutPanel1.Controls.Add(Me.Button1)
        Me.FlowLayoutPanel1.Controls.Add(Me.Button2)
        Me.FlowLayoutPanel1.Controls.Add(Me.Button3)
        Me.FlowLayoutPanel1.Controls.Add(Me.Button4)
        Me.FlowLayoutPanel1.Controls.Add(Me.Button5)
        Me.FlowLayoutPanel1.Controls.Add(Me.Button6)
        Me.FlowLayoutPanel1.Controls.Add(Me.Button7)
        Me.FlowLayoutPanel1.Controls.Add(Me.Button8)
        Me.FlowLayoutPanel1.Controls.Add(Me.Button9)
        Me.FlowLayoutPanel1.Location = New System.Drawing.Point(0, 16)
        Me.FlowLayoutPanel1.Name = "FlowLayoutPanel1"
        Me.FlowLayoutPanel1.Size = New System.Drawing.Size(256, 173)
        Me.FlowLayoutPanel1.TabIndex = 1
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(3, 3)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(72, 24)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Button1"
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(0, 0)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(84, 13)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "FlowLayoutPanel"
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(264, 0)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(89, 13)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "TableLayoutPanel"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(81, 3)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(72, 24)
        Me.Button2.TabIndex = 1
        Me.Button2.Text = "Button2"
        '
        'Button3
        '

        Me.Button3.Location = New System.Drawing.Point(159, 3)
        Me.Button3.Name = "Button3"

        Me.Button3.Size = New System.Drawing.Size(72, 24)        Me.Button3.TabIndex = 2
        Me.Button3.Text = "Button3"
        '
        'Button4
        '
        Me.Button4.Location = New System.Drawing.Point(3, 33)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(72, 24)
        Me.Button4.TabIndex = 3
        Me.Button4.Text = "Button4"
        '
        'Button5
        '
        Me.Button5.Location = New System.Drawing.Point(81, 33)
        Me.Button5.Name = "Button5"
        Me.Button5.Size = New System.Drawing.Size(72, 24)
        Me.Button5.TabIndex = 4
        Me.Button5.Text = "Button5"
        '
        'Button6
        '
        Me.Button6.Location = New System.Drawing.Point(159, 33)
        Me.Button6.Name = "Button6"
        Me.Button6.Size = New System.Drawing.Size(72, 24)
        Me.Button6.TabIndex = 5
        Me.Button6.Text = "Button6"
        '
        'Button7
        '
        Me.Button7.Location = New System.Drawing.Point(3, 63)
        Me.Button7.Name = "Button7"
        Me.Button7.Size = New System.Drawing.Size(72, 24)
        Me.Button7.TabIndex = 6
        Me.Button7.Text = "Button7"
        '
        'Button8
        '
        Me.Button8.Location = New System.Drawing.Point(81, 63)
        Me.Button8.Name = "Button8"
        Me.Button8.Size = New System.Drawing.Size(72, 24)
        Me.Button8.TabIndex = 7
        Me.Button8.Text = "Button8"
        '
        'Button9
        '
        Me.Button9.Location = New System.Drawing.Point(159, 63)
        Me.Button9.Name = "Button9"
        Me.Button9.Size = New System.Drawing.Size(72, 24)
        Me.Button9.TabIndex = 8
        Me.Button9.Text = "Button9"
        '
        'Button10
        '
        Me.Button10.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.Button10.Location = New System.Drawing.Point(26, 6)
        Me.Button10.Name = "Button10"
        Me.Button10.Size = New System.Drawing.Size(72, 24)
        Me.Button10.TabIndex = 9
        Me.Button10.Text = "Button10"
        '
        'Button11
        '
        Me.Button11.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.Button11.Location = New System.Drawing.Point(149, 6)
        Me.Button11.Name = "Button11"
        Me.Button11.Size = New System.Drawing.Size(72, 24)
        Me.Button11.TabIndex = 10
        Me.Button11.Text = "Button11"
        '
        'Button12
        '
        Me.Button12.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.Button12.Location = New System.Drawing.Point(26, 40)
        Me.Button12.Name = "Button12"
        Me.Button12.Size = New System.Drawing.Size(72, 24)
        Me.Button12.TabIndex = 11
        Me.Button12.Text = "Button12"
        '
        'Button13
        '
        Me.Button13.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.Button13.Location = New System.Drawing.Point(149, 40)
        Me.Button13.Name = "Button13"
        Me.Button13.Size = New System.Drawing.Size(72, 24)
        Me.Button13.TabIndex = 12
        Me.Button13.Text = "Button13"
        '
        'Button14
        '
        Me.Button14.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.Button14.Location = New System.Drawing.Point(26, 74)
        Me.Button14.Name = "Button14"
        Me.Button14.Size = New System.Drawing.Size(72, 24)
        Me.Button14.TabIndex = 13
        Me.Button14.Text = "Button14"
        '
        'Button15
        '
        Me.Button15.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.Button15.Location = New System.Drawing.Point(149, 74)
        Me.Button15.Name = "Button15"
        Me.Button15.Size = New System.Drawing.Size(72, 24)
        Me.Button15.TabIndex = 14
        Me.Button15.Text = "Button15"
        '
        'Button16
        '
        Me.Button16.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.Button16.Location = New System.Drawing.Point(26, 108)
        Me.Button16.Name = "Button16"
        Me.Button16.Size = New System.Drawing.Size(72, 24)
        Me.Button16.TabIndex = 15
        Me.Button16.Text = "Button16"
        '
        'Button17
        '
        Me.Button17.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.Button17.Location = New System.Drawing.Point(149, 108)
        Me.Button17.Name = "Button17"
        Me.Button17.Size = New System.Drawing.Size(72, 24)
        Me.Button17.TabIndex = 16
        Me.Button17.Text = "Button17"
        '
        'Button18
        '
        Me.Button18.Anchor = System.Windows.Forms.AnchorStyles.None
        Me.Button18.Location = New System.Drawing.Point(26, 142)
        Me.Button18.Name = "Button18"
        Me.Button18.Size = New System.Drawing.Size(72, 24)
        Me.Button18.TabIndex = 17
        Me.Button18.Text = "Button18"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(514, 190)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.FlowLayoutPanel1)
        Me.Controls.Add(Me.TableLayoutPanel1)
        Me.Name = "Form1"
        Me.Text = "FlowAndTableLayoutPanel"
        Me.TableLayoutPanel1.ResumeLayout(False)
        Me.FlowLayoutPanel1.ResumeLayout(False)
        Me.ResumeLayout(False)
        Me.PerformLayout()
    End Sub
    Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel
    Friend WithEvents FlowLayoutPanel1 As System.Windows.Forms.FlowLayoutPanel
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Button10 As System.Windows.Forms.Button
    Friend WithEvents Button11 As System.Windows.Forms.Button
    Friend WithEvents Button12 As System.Windows.Forms.Button
    Friend WithEvents Button13 As System.Windows.Forms.Button
    Friend WithEvents Button14 As System.Windows.Forms.Button
    Friend WithEvents Button15 As System.Windows.Forms.Button
    Friend WithEvents Button16 As System.Windows.Forms.Button
    Friend WithEvents Button17 As System.Windows.Forms.Button
    Friend WithEvents Button18 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents Button4 As System.Windows.Forms.Button
    Friend WithEvents Button5 As System.Windows.Forms.Button
    Friend WithEvents Button6 As System.Windows.Forms.Button
    Friend WithEvents Button7 As System.Windows.Forms.Button
    Friend WithEvents Button8 As System.Windows.Forms.Button
    Friend WithEvents Button9 As System.Windows.Forms.Button

End
Class

OUTPUT OF THE APPLICATION

GUI.jpg

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Become a Sponsor