' Project Controls ' Input data using VB Controls. Display the contents of ' the controls in a message box. Public Class Form1 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 Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents rad1 As System.Windows.Forms.RadioButton Friend WithEvents rad2 As System.Windows.Forms.RadioButton Friend WithEvents chk1 As System.Windows.Forms.CheckBox Friend WithEvents trk1 As System.Windows.Forms.TrackBar Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents cmd1 As System.Windows.Forms.Button Friend WithEvents txtValue As System.Windows.Forms.TextBox '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. Friend WithEvents txtString As System.Windows.Forms.TextBox Private Sub InitializeComponent() Me.cmd1 = New System.Windows.Forms.Button Me.GroupBox1 = New System.Windows.Forms.GroupBox Me.rad2 = New System.Windows.Forms.RadioButton Me.rad1 = New System.Windows.Forms.RadioButton Me.chk1 = New System.Windows.Forms.CheckBox Me.Label2 = New System.Windows.Forms.Label Me.Label3 = New System.Windows.Forms.Label Me.txtValue = New System.Windows.Forms.TextBox Me.trk1 = New System.Windows.Forms.TrackBar Me.txtString = New System.Windows.Forms.TextBox Me.GroupBox1.SuspendLayout() CType(Me.trk1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'cmd1 ' Me.cmd1.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.cmd1.Location = New System.Drawing.Point(128, 136) Me.cmd1.Name = "cmd1" Me.cmd1.Size = New System.Drawing.Size(152, 40) Me.cmd1.TabIndex = 6 Me.cmd1.Text = "Show Values" ' 'GroupBox1 ' Me.GroupBox1.Controls.Add(Me.rad2) Me.GroupBox1.Controls.Add(Me.rad1) Me.GroupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.GroupBox1.Location = New System.Drawing.Point(144, 8) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(136, 88) Me.GroupBox1.TabIndex = 1 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Radio Buttons" ' 'rad2 ' Me.rad2.Location = New System.Drawing.Point(8, 56) Me.rad2.Name = "rad2" Me.rad2.Size = New System.Drawing.Size(96, 24) Me.rad2.TabIndex = 1 Me.rad2.Text = "Button2" ' 'rad1 ' Me.rad1.Location = New System.Drawing.Point(8, 24) Me.rad1.Name = "rad1" Me.rad1.Size = New System.Drawing.Size(112, 24) Me.rad1.TabIndex = 0 Me.rad1.Text = "Button1" ' 'chk1 ' Me.chk1.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.chk1.Location = New System.Drawing.Point(152, 104) Me.chk1.Name = "chk1" Me.chk1.Size = New System.Drawing.Size(112, 24) Me.chk1.TabIndex = 2 Me.chk1.Text = "Check Box" ' 'Label2 ' Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label2.Location = New System.Drawing.Point(24, 112) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(24, 24) Me.Label2.TabIndex = 4 Me.Label2.Text = "0" ' 'Label3 ' Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label3.Location = New System.Drawing.Point(88, 112) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(40, 24) Me.Label3.TabIndex = 5 Me.Label3.Text = "100" ' 'txtValue ' Me.txtValue.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.txtValue.Location = New System.Drawing.Point(40, 144) Me.txtValue.Name = "txtValue" Me.txtValue.ReadOnly = True Me.txtValue.Size = New System.Drawing.Size(64, 29) Me.txtValue.TabIndex = 7 Me.txtValue.Text = "0" Me.txtValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Right ' 'trk1 ' Me.trk1.LargeChange = 10 Me.trk1.Location = New System.Drawing.Point(16, 64) Me.trk1.Maximum = 100 Me.trk1.Name = "trk1" Me.trk1.Size = New System.Drawing.Size(104, 45) Me.trk1.TabIndex = 3 Me.trk1.TickFrequency = 10 ' 'txtString ' Me.txtString.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.txtString.Location = New System.Drawing.Point(24, 24) Me.txtString.Name = "txtString" Me.txtString.Size = New System.Drawing.Size(96, 29) Me.txtString.TabIndex = 8 Me.txtString.Text = "" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(292, 189) Me.Controls.Add(Me.txtString) Me.Controls.Add(Me.txtValue) Me.Controls.Add(Me.cmd1) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.trk1) Me.Controls.Add(Me.chk1) Me.Controls.Add(Me.GroupBox1) Me.Name = "Form1" Me.Text = "Common VB Controls" Me.GroupBox1.ResumeLayout(False) CType(Me.trk1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region Private Sub trk1_Scroll(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles trk1.Scroll txtValue.Text = trk1.Value End Sub Private Sub cmd1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles cmd1.Click Dim output As String output = "txtString: " & txtString.Text & ControlChars.NewLine & _ "trk1 : " & trk1.Value & ControlChars.NewLine & _ "rad1 :" & rad1.Checked & ControlChars.NewLine & _ "rad2 :" & rad2.Checked & ControlChars.NewLine & _ "chk1 :" & chk1.Checked MessageBox.Show(output, "Data from Controls", _ MessageBoxButtons.OK, MessageBoxIcon.Information) End Sub End Class