Using GroupBoxes and Panels to hold buttons : GroupBox « GUI « VB.Net Tutorial

VB.Net Tutorial
1. Language Basics
2. Data Type
3. Operator
4. Statements
5. Date Time
6. Class Module
7. Development
8. Collections
9. Generics
10. Attributes
11. Event
12. Stream File
13. GUI
14. GUI Applications
15. 2D Graphics
16. I18N Internationlization
17. Reflection
18. Regular Expressions
19. Security
20. Socket Network
21. Thread
22. Windows
23. XML
24. Database ADO.net
25. Design Patterns
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
VB.Net Tutorial » GUI » GroupBox 
13. 31. 1. Using GroupBoxes and Panels to hold buttons
Using GroupBoxes and Panels to hold buttons
Imports System.Windows.Forms

public class GroupBoxPanel
   public Shared Sub Main
        Application.Run(New FrmGroupBox)
   End Sub
End class


Public Class FrmGroupBox
   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
   Friend WithEvents mainGroupBox As System.Windows.Forms.GroupBox
   Private WithEvents mainPanel As System.Windows.Forms.Panel
   Friend WithEvents cmdRight As System.Windows.Forms.Button
   Friend WithEvents cmdHi As System.Windows.Forms.Button
   Friend WithEvents cmdLeft As System.Windows.Forms.Button
   Friend WithEvents cmdBye As System.Windows.Forms.Button
   Friend WithEvents lblMessage As System.Windows.Forms.Label

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

   '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.cmdRight = New System.Windows.Forms.Button()
      Me.cmdBye = New System.Windows.Forms.Button()
      Me.mainPanel = New System.Windows.Forms.Panel()
      Me.cmdLeft = New System.Windows.Forms.Button()
      Me.cmdHi = New System.Windows.Forms.Button()
      Me.lblMessage = New System.Windows.Forms.Label()
      Me.mainGroupBox = New System.Windows.Forms.GroupBox()
      Me.mainPanel.SuspendLayout()
      Me.mainGroupBox.SuspendLayout()
      Me.SuspendLayout()
      '
      'cmdRight
      '
      Me.cmdRight.Location = New System.Drawing.Point(35232)
      Me.cmdRight.Name = "cmdRight"
      Me.cmdRight.Size = New System.Drawing.Size(7540)
      Me.cmdRight.TabIndex = 0
      Me.cmdRight.Text = "Far Right"
      '
      'cmdBye
      '
      Me.cmdBye.Location = New System.Drawing.Point(11240)
      Me.cmdBye.Name = "cmdBye"
      Me.cmdBye.Size = New System.Drawing.Size(7540)
      Me.cmdBye.TabIndex = 1
      Me.cmdBye.Text = "Bye"
      '
      'mainPanel
      '
      Me.mainPanel.AutoScroll = True
      Me.mainPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
      Me.mainPanel.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdLeft, Me.cmdRight})
      Me.mainPanel.Location = New System.Drawing.Point(40192)
      Me.mainPanel.Name = "mainPanel"
      Me.mainPanel.Size = New System.Drawing.Size(184112)
      Me.mainPanel.TabIndex = 1
      '
      'cmdLeft
      '
      Me.cmdLeft.Location = New System.Drawing.Point(1632)
      Me.cmdLeft.Name = "cmdLeft"
      Me.cmdLeft.Size = New System.Drawing.Size(7540)
      Me.cmdLeft.TabIndex = 1
      Me.cmdLeft.Text = "Far Left"
      '
      'cmdHi
      '
      Me.cmdHi.Location = New System.Drawing.Point(1640)
      Me.cmdHi.Name = "cmdHi"
      Me.cmdHi.Size = New System.Drawing.Size(7540)
      Me.cmdHi.TabIndex = 0
      Me.cmdHi.Text = "Hi"
      '
      'lblMessage
      '
      Me.lblMessage.Font = New System.Drawing.Font("Microsoft Sans Serif"11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
      Me.lblMessage.Location = New System.Drawing.Point(32136)
      Me.lblMessage.Name = "lblMessage"
      Me.lblMessage.Size = New System.Drawing.Size(20040)
      Me.lblMessage.TabIndex = 2
      Me.lblMessage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
      '
      'mainGroupBox
      '
      Me.mainGroupBox.Controls.AddRange(New System.Windows.Forms.Control() {Me.cmdBye, Me.cmdHi})
      Me.mainGroupBox.Location = New System.Drawing.Point(3216)
      Me.mainGroupBox.Name = "mainGroupBox"
      Me.mainGroupBox.TabIndex = 0
      Me.mainGroupBox.TabStop = False
      Me.mainGroupBox.Text = "Main GroupBox"
      '
      'FrmGroupBox
      '
      Me.AutoScaleBaseSize = New System.Drawing.Size(513)
      Me.ClientSize = New System.Drawing.Size(264333)
      Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblMessage, Me.mainPanel, Me.mainGroupBox})
      Me.Name = "FrmGroupBox"
      Me.Text = "GroupBoxPanelExample"
      Me.mainPanel.ResumeLayout(False)
      Me.mainGroupBox.ResumeLayout(False)
      Me.ResumeLayout(False)

   End Sub

#End Region

   Private Sub cmdHi_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgsHandles cmdHi.Click

      lblMessage.Text = "Hi pressed"
   End Sub 

   Private Sub cmdBye_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgsHandles cmdBye.Click

      lblMessage.Text = "Bye pressed"
   End Sub 
   Private Sub cmdLeft_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgsHandles cmdLeft.Click

      lblMessage.Text = "Far left pressed"
   End Sub 
   Private Sub cmdRight_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgsHandles cmdRight.Click

      lblMessage.Text = "Far right pressed"
   End Sub 

End Class
13. 31. GroupBox
13. 31. 1. Using GroupBoxes and Panels to hold buttonsUsing GroupBoxes and Panels to hold buttons
13. 31. 2. Resize a group boxResize a group box
13. 31. 3. Add title to group boxAdd title to group box
w__w___w_.j_a__va___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.