Mega Code Archive

 
Categories / VB.Net Tutorial / GUI
 

Tab Control

Imports System.Windows.Forms public class TabControl    public Shared Sub Main         Application.Run(New Form1)    End Sub End class Public Class Form1     Inherits System.Windows.Forms.Form     Public Sub New()         MyBase.New()         InitializeComponent()     End Sub     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     Private components As System.ComponentModel.IContainer     Friend WithEvents TabControl1 As System.Windows.Forms.TabControl     Friend WithEvents TabPage1 As System.Windows.Forms.TabPage     Friend WithEvents TabPage2 As System.Windows.Forms.TabPage     Friend WithEvents TabPage3 As System.Windows.Forms.TabPage     Friend WithEvents TabPage4 As System.Windows.Forms.TabPage     Friend WithEvents TabPage5 As System.Windows.Forms.TabPage     Friend WithEvents TabPage6 As System.Windows.Forms.TabPage     Friend WithEvents ListBox1 As System.Windows.Forms.ListBox     Friend WithEvents Button1 As System.Windows.Forms.Button     Friend WithEvents Button2 As System.Windows.Forms.Button     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()         Me.TabControl1 = New System.Windows.Forms.TabControl         Me.TabPage1 = New System.Windows.Forms.TabPage         Me.TabPage2 = New System.Windows.Forms.TabPage         Me.TabPage3 = New System.Windows.Forms.TabPage         Me.TabPage4 = New System.Windows.Forms.TabPage         Me.TabPage5 = New System.Windows.Forms.TabPage         Me.TabPage6 = New System.Windows.Forms.TabPage         Me.ListBox1 = New System.Windows.Forms.ListBox         Me.Button1 = New System.Windows.Forms.Button         Me.Button2 = New System.Windows.Forms.Button         Me.TabControl1.SuspendLayout()         Me.TabPage1.SuspendLayout()         Me.SuspendLayout()         '         'TabControl1         '         Me.TabControl1.Controls.Add(Me.TabPage1)         Me.TabControl1.Controls.Add(Me.TabPage3)         Me.TabControl1.Controls.Add(Me.TabPage2)         Me.TabControl1.Controls.Add(Me.TabPage4)         Me.TabControl1.Controls.Add(Me.TabPage5)         Me.TabControl1.Controls.Add(Me.TabPage6)         Me.TabControl1.Location = New System.Drawing.Point(40, 24)         Me.TabControl1.Multiline = True         Me.TabControl1.Name = "TabControl1"         Me.TabControl1.SelectedIndex = 0         Me.TabControl1.Size = New System.Drawing.Size(208, 208)         Me.TabControl1.TabIndex = 0         '         'TabPage1         '         Me.TabPage1.Controls.Add(Me.Button2)         Me.TabPage1.Controls.Add(Me.Button1)         Me.TabPage1.Controls.Add(Me.ListBox1)         Me.TabPage1.Location = New System.Drawing.Point(4, 40)         Me.TabPage1.Name = "TabPage1"         Me.TabPage1.Size = New System.Drawing.Size(200, 164)         Me.TabPage1.TabIndex = 0         Me.TabPage1.Text = "A"         '         'TabPage2         '         Me.TabPage2.Location = New System.Drawing.Point(4, 22)         Me.TabPage2.Name = "TabPage2"         Me.TabPage2.Size = New System.Drawing.Size(232, 182)         Me.TabPage2.TabIndex = 1         Me.TabPage2.Text = "B"         '         'TabPage3         '         Me.TabPage3.Location = New System.Drawing.Point(4, 40)         Me.TabPage3.Name = "TabPage3"         Me.TabPage3.Size = New System.Drawing.Size(200, 164)         Me.TabPage3.TabIndex = 2         Me.TabPage3.Text = "C"         '         'TabPage4         '         Me.TabPage4.Location = New System.Drawing.Point(4, 40)         Me.TabPage4.Name = "TabPage4"         Me.TabPage4.Size = New System.Drawing.Size(232, 164)         Me.TabPage4.TabIndex = 3         Me.TabPage4.Text = "D"         '         'TabPage5         '         Me.TabPage5.Location = New System.Drawing.Point(4, 40)         Me.TabPage5.Name = "TabPage5"         Me.TabPage5.Size = New System.Drawing.Size(232, 164)         Me.TabPage5.TabIndex = 4         Me.TabPage5.Text = "E"         '         'TabPage6         '         Me.TabPage6.Location = New System.Drawing.Point(4, 40)         Me.TabPage6.Name = "TabPage6"         Me.TabPage6.Size = New System.Drawing.Size(200, 164)         Me.TabPage6.TabIndex = 5         Me.TabPage6.Text = "F"         '         'ListBox1         '         Me.ListBox1.Items.AddRange(New Object() {"A", "B", "C"})         Me.ListBox1.Location = New System.Drawing.Point(16, 16)         Me.ListBox1.Name = "ListBox1"         Me.ListBox1.Size = New System.Drawing.Size(88, 108)         Me.ListBox1.TabIndex = 0         '         'Button1         '         Me.Button1.Location = New System.Drawing.Point(120, 32)         Me.Button1.Name = "Button1"         Me.Button1.Size = New System.Drawing.Size(56, 24)         Me.Button1.TabIndex = 1         Me.Button1.Text = "Add"         '         'Button2         '         Me.Button2.Location = New System.Drawing.Point(120, 88)         Me.Button2.Name = "Button2"         Me.Button2.Size = New System.Drawing.Size(56, 24)         Me.Button2.TabIndex = 2         Me.Button2.Text = "Delete"         '         'Form1         '         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)         Me.ClientSize = New System.Drawing.Size(292, 266)         Me.Controls.Add(Me.TabControl1)         Me.TabControl1.ResumeLayout(False)         Me.TabPage1.ResumeLayout(False)         Me.ResumeLayout(False)     End Sub     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click         ListBox1.Items.Add("str")     End Sub     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click         ListBox1.Items.Remove(ListBox1.SelectedItem)     End Sub End Class