VB.Net/GUI/Radio Button

Материал из VB Эксперт
Перейти к: навигация, поиск

Get selected Radio Button

<source lang="vbnet"> Imports System.Windows.Forms Module Module1

   Sub Main()
       Application.Run(New Form1)
   End Sub

End Module

Public Class Form1

   Inherits System.Windows.Forms.Form
  1. 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
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.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 Label1 As System.Windows.Forms.Label
   Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
   Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
   Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
       Me.Label1 = New System.Windows.Forms.Label()
       Me.RadioButton1 = New System.Windows.Forms.RadioButton()
       Me.RadioButton2 = New System.Windows.Forms.RadioButton()
       Me.RadioButton3 = New System.Windows.Forms.RadioButton()
       Me.SuspendLayout()
       "
       "Label1
       "
       Me.Label1.Location = New System.Drawing.Point(32, 152)
       Me.Label1.Name = "Label1"
       Me.Label1.Size = New System.Drawing.Size(232, 23)
       Me.Label1.TabIndex = 0
       "
       "RadioButton1
       "
       Me.RadioButton1.Location = New System.Drawing.Point(32, 24)
       Me.RadioButton1.Name = "RadioButton1"
       Me.RadioButton1.TabIndex = 1
       Me.RadioButton1.Text = "Windows 2000"
       "
       "RadioButton2
       "
       Me.RadioButton2.Location = New System.Drawing.Point(32, 64)
       Me.RadioButton2.Name = "RadioButton2"
       Me.RadioButton2.TabIndex = 2
       Me.RadioButton2.Text = "Linux"
       "
       "RadioButton3
       "
       Me.RadioButton3.Location = New System.Drawing.Point(32, 104)
       Me.RadioButton3.Name = "RadioButton3"
       Me.RadioButton3.TabIndex = 3
       Me.RadioButton3.Text = "Mac OS"
       "
       "Form1
       "
       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
       Me.ClientSize = New System.Drawing.Size(296, 213)
       Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.RadioButton3, Me.RadioButton2, Me.RadioButton1, Me.Label1})
       Me.Name = "Form1"
       Me.Text = "RadioButtonDemo"
       Me.ResumeLayout(False)
   End Sub
  1. End Region
   Private Sub RadioButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton1.Click
       Label1.Text = "Current choice: " & RadioButton1.Text
       Label1.Refresh()
   End Sub
   Private Sub RadioButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton2.Click
       Label1.Text = "Current choice: " & RadioButton2.Text
       Label1.Refresh()
   End Sub
   Private Sub RadioButton3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton3.Click
       Label1.Text = "Current choice: " & RadioButton3.Text
       Label1.Refresh()
   End Sub

End Class

      </source>


Group RadioButton

<source lang="vbnet"> Imports System Imports System.Data Imports System.Windows.Forms Imports System.Drawing Imports System.Diagnostics Imports System.Drawing.Printing Imports System.ruponentModel

Public Class MainClass

   Shared Sub Main()
       
      Dim form1 As Form = New Form1
      Application.Run(form1) 
   End Sub

End Class


<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ 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
   Private components As System.ruponentModel.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.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
       Me.GroupBox3 = New System.Windows.Forms.GroupBox
       Me.RadioButton7 = New System.Windows.Forms.RadioButton
       Me.RadioButton8 = New System.Windows.Forms.RadioButton
       Me.RadioButton9 = New System.Windows.Forms.RadioButton
       Me.GroupBox2 = New System.Windows.Forms.GroupBox
       Me.RadioButton4 = New System.Windows.Forms.RadioButton
       Me.RadioButton5 = New System.Windows.Forms.RadioButton
       Me.RadioButton6 = New System.Windows.Forms.RadioButton
       Me.GroupBox1 = New System.Windows.Forms.GroupBox
       Me.RadioButton3 = New System.Windows.Forms.RadioButton
       Me.RadioButton2 = New System.Windows.Forms.RadioButton
       Me.RadioButton1 = New System.Windows.Forms.RadioButton
       Me.GroupBox3.SuspendLayout()
       Me.GroupBox2.SuspendLayout()
       Me.GroupBox1.SuspendLayout()
       Me.SuspendLayout()
       "
       "GroupBox3
       "
       Me.GroupBox3.Controls.Add(Me.RadioButton7)
       Me.GroupBox3.Controls.Add(Me.RadioButton8)
       Me.GroupBox3.Controls.Add(Me.RadioButton9)
       Me.GroupBox3.Location = New System.Drawing.Point(8, 200)
       Me.GroupBox3.Name = "GroupBox3"
       Me.GroupBox3.Size = New System.Drawing.Size(176, 88)
       Me.GroupBox3.TabIndex = 7
       Me.GroupBox3.TabStop = False
       Me.GroupBox3.Text = "Dessert"
       "
       "RadioButton7
       "
       Me.RadioButton7.AutoSize = True
       Me.RadioButton7.Checked = True
       Me.RadioButton7.Location = New System.Drawing.Point(24, 64)
       Me.RadioButton7.Name = "RadioButton7"
       Me.RadioButton7.Size = New System.Drawing.Size(57, 17)
       Me.RadioButton7.TabIndex = 2
       Me.RadioButton7.Text = "Antacid"
       "
       "RadioButton8
       "
       Me.RadioButton8.AutoSize = True
       Me.RadioButton8.Location = New System.Drawing.Point(24, 40)
       Me.RadioButton8.Name = "RadioButton8"
       Me.RadioButton8.Size = New System.Drawing.Size(46, 17)
       Me.RadioButton8.TabIndex = 1
       Me.RadioButton8.TabStop = False
       Me.RadioButton8.Text = "Cake"
       "
       "RadioButton9
       "
       Me.RadioButton9.AutoSize = True
       Me.RadioButton9.Location = New System.Drawing.Point(24, 16)
       Me.RadioButton9.Name = "RadioButton9"
       Me.RadioButton9.Size = New System.Drawing.Size(69, 17)
       Me.RadioButton9.TabIndex = 0
       Me.RadioButton9.TabStop = False
       Me.RadioButton9.Text = "Ice Cream"
       "
       "GroupBox2
       "
       Me.GroupBox2.Controls.Add(Me.RadioButton4)
       Me.GroupBox2.Controls.Add(Me.RadioButton5)
       Me.GroupBox2.Controls.Add(Me.RadioButton6)
       Me.GroupBox2.Location = New System.Drawing.Point(8, 104)
       Me.GroupBox2.Name = "GroupBox2"
       Me.GroupBox2.Size = New System.Drawing.Size(176, 88)
       Me.GroupBox2.TabIndex = 6
       Me.GroupBox2.TabStop = False
       Me.GroupBox2.Text = "Entree"
       "
       "RadioButton4
       "
       Me.RadioButton4.AutoSize = True
       Me.RadioButton4.Location = New System.Drawing.Point(24, 64)
       Me.RadioButton4.Name = "RadioButton4"
       Me.RadioButton4.Size = New System.Drawing.Size(112, 17)
       Me.RadioButton4.TabIndex = 2
       Me.RadioButton4.TabStop = False
       Me.RadioButton4.Text = "Hot and Sour Soup"
       "
       "RadioButton5
       "
       Me.RadioButton5.AutoSize = True
       Me.RadioButton5.Checked = True
       Me.RadioButton5.Location = New System.Drawing.Point(24, 40)
       Me.RadioButton5.Name = "RadioButton5"
       Me.RadioButton5.Size = New System.Drawing.Size(40, 17)
       Me.RadioButton5.TabIndex = 1
       Me.RadioButton5.Text = "Chili"
       "
       "RadioButton6
       "
       Me.RadioButton6.AutoSize = True
       Me.RadioButton6.Location = New System.Drawing.Point(24, 16)
       Me.RadioButton6.Name = "RadioButton6"
       Me.RadioButton6.Size = New System.Drawing.Size(51, 17)
       Me.RadioButton6.TabIndex = 0
       Me.RadioButton6.TabStop = False
       Me.RadioButton6.Text = "Burrito"
       "
       "GroupBox1
       "
       Me.GroupBox1.Controls.Add(Me.RadioButton3)
       Me.GroupBox1.Controls.Add(Me.RadioButton2)
       Me.GroupBox1.Controls.Add(Me.RadioButton1)
       Me.GroupBox1.Location = New System.Drawing.Point(8, 8)
       Me.GroupBox1.Name = "GroupBox1"
       Me.GroupBox1.Size = New System.Drawing.Size(176, 88)
       Me.GroupBox1.TabIndex = 5
       Me.GroupBox1.TabStop = False
       Me.GroupBox1.Text = "Appetizer"
       "
       "RadioButton3
       "
       Me.RadioButton3.AutoSize = True
       Me.RadioButton3.Location = New System.Drawing.Point(24, 64)
       Me.RadioButton3.Name = "RadioButton3"
       Me.RadioButton3.Size = New System.Drawing.Size(111, 17)
       Me.RadioButton3.TabIndex = 2
       Me.RadioButton3.TabStop = False
       Me.RadioButton3.Text = "Curried Mushrooms"
       "
       "RadioButton2
       "
       Me.RadioButton2.AutoSize = True
       Me.RadioButton2.Location = New System.Drawing.Point(24, 40)
       Me.RadioButton2.Name = "RadioButton2"
       Me.RadioButton2.Size = New System.Drawing.Size(141, 17)
       Me.RadioButton2.TabIndex = 1
       Me.RadioButton2.TabStop = False
       Me.RadioButton2.Text = "Spicy Pickled Vegetables"
       "
       "RadioButton1
       "
       Me.RadioButton1.AutoSize = True
       Me.RadioButton1.Checked = True
       Me.RadioButton1.Location = New System.Drawing.Point(24, 16)
       Me.RadioButton1.Name = "RadioButton1"
       Me.RadioButton1.Size = New System.Drawing.Size(71, 17)
       Me.RadioButton1.TabIndex = 0
       Me.RadioButton1.Text = "Hot Wings"
       "
       "Form1
       "
       Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
       Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
       Me.ClientSize = New System.Drawing.Size(193, 298)
       Me.Controls.Add(Me.GroupBox3)
       Me.Controls.Add(Me.GroupBox2)
       Me.Controls.Add(Me.GroupBox1)
       Me.Name = "Form1"
       Me.Text = "UseRadioButton"
       Me.GroupBox3.ResumeLayout(False)
       Me.GroupBox3.PerformLayout()
       Me.GroupBox2.ResumeLayout(False)
       Me.GroupBox2.PerformLayout()
       Me.GroupBox1.ResumeLayout(False)
       Me.GroupBox1.PerformLayout()
       Me.ResumeLayout(False)
   End Sub
   Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox
   Friend WithEvents RadioButton7 As System.Windows.Forms.RadioButton
   Friend WithEvents RadioButton8 As System.Windows.Forms.RadioButton
   Friend WithEvents RadioButton9 As System.Windows.Forms.RadioButton
   Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
   Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton
   Friend WithEvents RadioButton5 As System.Windows.Forms.RadioButton
   Friend WithEvents RadioButton6 As System.Windows.Forms.RadioButton
   Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
   Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton
   Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
   Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton

End Class

      </source>


RadioButton Action Demo

<source lang="vbnet"> Imports System Imports System.Data Imports System.Collections Imports System.Windows.Forms Public Class MainClass

   Shared Sub Main()
       Dim form1 As Form = New Form1()
       Application.Run(form1)
   End Sub

End Class Public Class Form1

   Inherits System.Windows.Forms.Form
  1. 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
   "Required by the Windows Form Designer
   Private components As System.ruponentModel.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 txtWords As System.Windows.Forms.TextBox
   Friend WithEvents Label1 As System.Windows.Forms.Label
   Friend WithEvents radCountChars As System.Windows.Forms.RadioButton
   Friend WithEvents radCountWords As System.Windows.Forms.RadioButton
   Friend WithEvents Label2 As System.Windows.Forms.Label
   Friend WithEvents lblResults As System.Windows.Forms.Label
   <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
       Me.txtWords = New System.Windows.Forms.TextBox()
       Me.Label1 = New System.Windows.Forms.Label()
       Me.radCountChars = New System.Windows.Forms.RadioButton()
       Me.radCountWords = New System.Windows.Forms.RadioButton()
       Me.Label2 = New System.Windows.Forms.Label()
       Me.lblResults = New System.Windows.Forms.Label()
       Me.SuspendLayout()
       "
       "txtWords
       "
       Me.txtWords.Location = New System.Drawing.Point(8, 32)
       Me.txtWords.Multiline = True
       Me.txtWords.Name = "txtWords"
       Me.txtWords.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
       Me.txtWords.Size = New System.Drawing.Size(352, 152)
       Me.txtWords.TabIndex = 0
       Me.txtWords.Text = ""
       "
       "Label1
       "
       Me.Label1.Location = New System.Drawing.Point(8, 8)
       Me.Label1.Name = "Label1"
       Me.Label1.Size = New System.Drawing.Size(160, 23)
       Me.Label1.TabIndex = 1
       Me.Label1.Text = "Enter some text into this box?"
       "
       "radCountChars
       "
       Me.radCountChars.Checked = True
       Me.radCountChars.Location = New System.Drawing.Point(8, 192)
       Me.radCountChars.Name = "radCountChars"
       Me.radCountChars.Size = New System.Drawing.Size(56, 32)
       Me.radCountChars.TabIndex = 2
       Me.radCountChars.TabStop = True
       Me.radCountChars.Text = "Chars"
       "
       "radCountWords
       "
       Me.radCountWords.Location = New System.Drawing.Point(64, 192)
       Me.radCountWords.Name = "radCountWords"
       Me.radCountWords.Size = New System.Drawing.Size(56, 32)
       Me.radCountWords.TabIndex = 3
       Me.radCountWords.Text = "Words"
       "
       "Label2
       "
       Me.Label2.Location = New System.Drawing.Point(128, 200)
       Me.Label2.Name = "Label2"
       Me.Label2.Size = New System.Drawing.Size(88, 16)
       Me.Label2.TabIndex = 4
       Me.Label2.Text = "The results are:"
       "
       "lblResults
       "
       Me.lblResults.Location = New System.Drawing.Point(208, 200)
       Me.lblResults.Name = "lblResults"
       Me.lblResults.Size = New System.Drawing.Size(80, 16)
       Me.lblResults.TabIndex = 5
       "
       "Form1
       "
       Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
       Me.ClientSize = New System.Drawing.Size(368, 229)
       Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblResults, Me.Label2, Me.radCountWords, Me.radCountChars, Me.Label1, Me.txtWords})
       Me.Name = "Form1"
       Me.Text = "Word Counter"
       Me.ResumeLayout(False)
   End Sub
  1. End Region
   Public Function CountCharacters(ByVal text As String) As Integer
       Return text.Length
   End Function
   Public Function CountWords(ByVal text As String) As Integer
       If txtWords.Text = "" Then Return 0
       Dim words() As String = text.Split(" ".ToCharArray())
       Return words.Length
   End Function
   Public Sub UpdateDisplay()
       Dim countText As String = txtWords.Text
       Dim resultText As String
       If radCountWords.Checked = True Then
           Dim numWords As Integer = CountWords(countText)
           resultText = numWords & " words"
       Else
           Dim numChars As Integer = CountCharacters(countText)
           resultText = numChars & " characters"
       End If
       lblResults.Text = resultText
       
   End Sub
   Private Sub txtWords_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtWords.TextChanged
       UpdateDisplay()
   End Sub
   Private Sub radCountWords_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radCountWords.CheckedChanged
       UpdateDisplay()
   End Sub
   Private Sub radCountChars_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radCountChars.CheckedChanged
       UpdateDisplay()
   End Sub

End Class

      </source>


Radio Button: Change Font and Paint

<source lang="vbnet"> Imports System Imports System.Drawing Imports System.ruponentModel Imports System.Windows.Forms

Public Class MainClass

   Shared Sub Main(ByVal args As String())
       Dim myform As Form = New Form1()
       Application.Run(myform)
   End Sub

End Class

Public Class Form1

   Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
       e.Graphics.DrawString("www.vbex.ru", Me.Font, Brushes.Black, 10, 10)
   End Sub
   Private Sub RadioButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.Click, RadioButton2.Click, RadioButton3.Click
       Dim radio_button As RadioButton = DirectCast(sender, RadioButton)
       Me.Font = New Font(radio_button.Text, 20)
   End Sub

End Class

<Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()> _ 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
   Private components As System.ruponentModel.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.
   <System.Diagnostics.DebuggerStepThrough()> _
   Private Sub InitializeComponent()
       Me.RadioButton1 = New System.Windows.Forms.RadioButton
       Me.RadioButton2 = New System.Windows.Forms.RadioButton
       Me.RadioButton3 = New System.Windows.Forms.RadioButton
       Me.SuspendLayout()
       "
       "RadioButton1
       "
       Me.RadioButton1.AutoSize = True
       Me.RadioButton1.Checked = True
       Me.RadioButton1.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
       Me.RadioButton1.Location = New System.Drawing.Point(264, 8)
       Me.RadioButton1.Name = "RadioButton1"
       Me.RadioButton1.Size = New System.Drawing.Size(114, 22)
       Me.RadioButton1.TabIndex = 0
       Me.RadioButton1.Text = "Comic Sans MS"
       "
       "RadioButton2
       "
       Me.RadioButton2.AutoSize = True
       Me.RadioButton2.Font = New System.Drawing.Font("Times New Roman", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
       Me.RadioButton2.Location = New System.Drawing.Point(264, 40)
       Me.RadioButton2.Name = "RadioButton2"
       Me.RadioButton2.Size = New System.Drawing.Size(120, 19)
       Me.RadioButton2.TabIndex = 1
       Me.RadioButton2.TabStop = False
       Me.RadioButton2.Text = "Times New Roman"
       "
       "RadioButton3
       "
       Me.RadioButton3.AutoSize = True
       Me.RadioButton3.Font = New System.Drawing.Font("Papyrus", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
       Me.RadioButton3.Location = New System.Drawing.Point(264, 72)
       Me.RadioButton3.Name = "RadioButton3"
       Me.RadioButton3.Size = New System.Drawing.Size(70, 25)
       Me.RadioButton3.TabIndex = 2
       Me.RadioButton3.TabStop = False
       Me.RadioButton3.Text = "Papyrus"
       "
       "Form1
       "
       Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None
       Me.ClientSize = New System.Drawing.Size(397, 156)
       Me.Controls.Add(Me.RadioButton3)
       Me.Controls.Add(Me.RadioButton2)
       Me.Controls.Add(Me.RadioButton1)
       Me.Name = "Form1"
       Me.Text = "DrawFonts"
       Me.ResumeLayout(False)
       Me.PerformLayout()
   End Sub
   Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
   Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
   Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton

End Class

      </source>


Using RadioButtons to set message window options

<source lang="vbnet"> Imports System Imports System.Drawing Imports System.Windows.Forms Public Class MainClass

  Shared Sub Main()
       Dim myform As Form = New FrmRadioButton()
       Application.Run(myform)
  End Sub " Main

End Class Public Class FrmRadioButton

  Inherits System.Windows.Forms.Form
  Private iconType As MessageBoxIcon
  Private buttonType As MessageBoxButtons
  1. 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 iconGroupBox As System.Windows.Forms.GroupBox
  Friend WithEvents buttonTypeGroupBox As System.Windows.Forms.GroupBox
  Friend WithEvents radRetryCancel As System.Windows.Forms.RadioButton
  Friend WithEvents radYesNo As System.Windows.Forms.RadioButton
  Friend WithEvents radAbortRetryIgnore As System.Windows.Forms.RadioButton
  Friend WithEvents radOk As System.Windows.Forms.RadioButton
  Friend WithEvents radWarning As System.Windows.Forms.RadioButton
  Friend WithEvents radStop As System.Windows.Forms.RadioButton
  Friend WithEvents radQuestion As System.Windows.Forms.RadioButton
  Friend WithEvents radInformation As System.Windows.Forms.RadioButton
  Friend WithEvents radHand As System.Windows.Forms.RadioButton
  Friend WithEvents radExclamation As System.Windows.Forms.RadioButton
  Friend WithEvents radError As System.Windows.Forms.RadioButton
  Friend WithEvents radAsterisk As System.Windows.Forms.RadioButton
  Friend WithEvents cmdDisplay As System.Windows.Forms.Button
  Friend WithEvents lblDisplay As System.Windows.Forms.Label
  Friend WithEvents radOkCancel As System.Windows.Forms.RadioButton
  Friend WithEvents radYesNoCancel As System.Windows.Forms.RadioButton
  "Required by the Windows Form Designer
  Private components As System.ruponentModel.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.radAbortRetryIgnore = New System.Windows.Forms.RadioButton()
     Me.radStop = New System.Windows.Forms.RadioButton()
     Me.radYesNo = New System.Windows.Forms.RadioButton()
     Me.iconGroupBox = New System.Windows.Forms.GroupBox()
     Me.radWarning = New System.Windows.Forms.RadioButton()
     Me.radQuestion = New System.Windows.Forms.RadioButton()
     Me.radInformation = New System.Windows.Forms.RadioButton()
     Me.radHand = New System.Windows.Forms.RadioButton()
     Me.radExclamation = New System.Windows.Forms.RadioButton()
     Me.radError = New System.Windows.Forms.RadioButton()
     Me.radAsterisk = New System.Windows.Forms.RadioButton()
     Me.radYesNoCancel = New System.Windows.Forms.RadioButton()
     Me.radOk = New System.Windows.Forms.RadioButton()
     Me.cmdDisplay = New System.Windows.Forms.Button()
     Me.lblDisplay = New System.Windows.Forms.Label()
     Me.buttonTypeGroupBox = New System.Windows.Forms.GroupBox()
     Me.radRetryCancel = New System.Windows.Forms.RadioButton()
     Me.radOkCancel = New System.Windows.Forms.RadioButton()
     Me.iconGroupBox.SuspendLayout()
     Me.buttonTypeGroupBox.SuspendLayout()
     Me.SuspendLayout()
     "
     "radAbortRetryIgnore
     "
     Me.radAbortRetryIgnore.Location = New System.Drawing.Point(16, 88)
     Me.radAbortRetryIgnore.Name = "radAbortRetryIgnore"
     Me.radAbortRetryIgnore.Size = New System.Drawing.Size(120, 24)
     Me.radAbortRetryIgnore.TabIndex = 2
     Me.radAbortRetryIgnore.Text = "Abort Retry Ignore"
     "
     "radStop
     "
     Me.radStop.Location = New System.Drawing.Point(16, 240)
     Me.radStop.Name = "radStop"
     Me.radStop.Size = New System.Drawing.Size(128, 24)
     Me.radStop.TabIndex = 6
     Me.radStop.Text = "Stop"
     "
     "radYesNo
     "
     Me.radYesNo.Location = New System.Drawing.Point(16, 160)
     Me.radYesNo.Name = "radYesNo"
     Me.radYesNo.Size = New System.Drawing.Size(120, 16)
     Me.radYesNo.TabIndex = 4
     Me.radYesNo.Text = "Yes/No"
     "
     "iconGroupBox
     "
     Me.iconGroupBox.Controls.AddRange(New System.Windows.Forms.Control() {Me.radWarning, Me.radStop, Me.radQuestion, Me.radInformation, Me.radHand, Me.radExclamation, Me.radError, Me.radAsterisk})
     Me.iconGroupBox.Location = New System.Drawing.Point(200, 16)
     Me.iconGroupBox.Name = "iconGroupBox"
     Me.iconGroupBox.Size = New System.Drawing.Size(160, 304)
     Me.iconGroupBox.TabIndex = 3
     Me.iconGroupBox.TabStop = False
     Me.iconGroupBox.Text = "Icon"
     "
     "radWarning
     "
     Me.radWarning.Location = New System.Drawing.Point(16, 272)
     Me.radWarning.Name = "radWarning"
     Me.radWarning.Size = New System.Drawing.Size(128, 24)
     Me.radWarning.TabIndex = 7
     Me.radWarning.Text = "Warning"
     "
     "radQuestion
     "
     Me.radQuestion.Location = New System.Drawing.Point(16, 208)
     Me.radQuestion.Name = "radQuestion"
     Me.radQuestion.Size = New System.Drawing.Size(128, 24)
     Me.radQuestion.TabIndex = 5
     Me.radQuestion.Text = "Question"
     "
     "radInformation
     "
     Me.radInformation.Location = New System.Drawing.Point(16, 168)
     Me.radInformation.Name = "radInformation"
     Me.radInformation.Size = New System.Drawing.Size(128, 24)
     Me.radInformation.TabIndex = 4
     Me.radInformation.Text = "Information"
     "
     "radHand
     "
     Me.radHand.Location = New System.Drawing.Point(16, 128)
     Me.radHand.Name = "radHand"
     Me.radHand.Size = New System.Drawing.Size(128, 24)
     Me.radHand.TabIndex = 3
     Me.radHand.Text = "Hand"
     "
     "radExclamation
     "
     Me.radExclamation.Location = New System.Drawing.Point(16, 88)
     Me.radExclamation.Name = "radExclamation"
     Me.radExclamation.Size = New System.Drawing.Size(136, 24)
     Me.radExclamation.TabIndex = 2
     Me.radExclamation.Text = "Exclamation"
     "
     "radError
     "
     Me.radError.Location = New System.Drawing.Point(16, 48)
     Me.radError.Name = "radError"
     Me.radError.Size = New System.Drawing.Size(136, 24)
     Me.radError.TabIndex = 1
     Me.radError.Text = "Error"
     "
     "radAsterisk
     "
     Me.radAsterisk.Location = New System.Drawing.Point(16, 16)
     Me.radAsterisk.Name = "radAsterisk"
     Me.radAsterisk.Size = New System.Drawing.Size(136, 24)
     Me.radAsterisk.TabIndex = 0
     Me.radAsterisk.Text = "Asterisk"
     "
     "radYesNoCancel
     "
     Me.radYesNoCancel.Location = New System.Drawing.Point(16, 120)
     Me.radYesNoCancel.Name = "radYesNoCancel"
     Me.radYesNoCancel.Size = New System.Drawing.Size(120, 24)
     Me.radYesNoCancel.TabIndex = 3
     Me.radYesNoCancel.Text = "Yes/No/Cancel"
     "
     "radOk
     "
     Me.radOk.Location = New System.Drawing.Point(16, 24)
     Me.radOk.Name = "radOk"
     Me.radOk.Size = New System.Drawing.Size(112, 16)
     Me.radOk.TabIndex = 0
     Me.radOk.Text = "OK"
     "
     "cmdDisplay
     "
     Me.cmdDisplay.Location = New System.Drawing.Point(32, 240)
     Me.cmdDisplay.Name = "cmdDisplay"
     Me.cmdDisplay.Size = New System.Drawing.Size(112, 40)
     Me.cmdDisplay.TabIndex = 1
     Me.cmdDisplay.Text = "Display"
     "
     "lblDisplay
     "
     Me.lblDisplay.Location = New System.Drawing.Point(24, 296)
     Me.lblDisplay.Name = "lblDisplay"
     Me.lblDisplay.Size = New System.Drawing.Size(144, 24)
     Me.lblDisplay.TabIndex = 5
     "
     "buttonTypeGroupBox
     "
     Me.buttonTypeGroupBox.Controls.AddRange(New System.Windows.Forms.Control() {Me.radRetryCancel, Me.radYesNo, Me.radYesNoCancel, Me.radAbortRetryIgnore, Me.radOkCancel, Me.radOk})
     Me.buttonTypeGroupBox.Location = New System.Drawing.Point(16, 16)
     Me.buttonTypeGroupBox.Name = "buttonTypeGroupBox"
     Me.buttonTypeGroupBox.Size = New System.Drawing.Size(144, 216)
     Me.buttonTypeGroupBox.TabIndex = 2
     Me.buttonTypeGroupBox.TabStop = False
     Me.buttonTypeGroupBox.Text = "Button Type"
     "
     "radRetryCancel
     "
     Me.radRetryCancel.Location = New System.Drawing.Point(16, 192)
     Me.radRetryCancel.Name = "radRetryCancel"
     Me.radRetryCancel.Size = New System.Drawing.Size(104, 16)
     Me.radRetryCancel.TabIndex = 5
     Me.radRetryCancel.Text = "Retry/Cancel"
     "
     "radOkCancel
     "
     Me.radOkCancel.Location = New System.Drawing.Point(16, 56)
     Me.radOkCancel.Name = "radOkCancel"
     Me.radOkCancel.Size = New System.Drawing.Size(120, 24)
     Me.radOkCancel.TabIndex = 1
     Me.radOkCancel.Text = "OK/Cancel"
     "
     "FrmRadioButton
     "
     Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
     Me.ClientSize = New System.Drawing.Size(384, 333)
     Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblDisplay, Me.iconGroupBox, Me.buttonTypeGroupBox, Me.cmdDisplay})
     Me.Name = "FrmRadioButton"
     Me.Text = "RadioButtonTest"
     Me.iconGroupBox.ResumeLayout(False)
     Me.buttonTypeGroupBox.ResumeLayout(False)
     Me.ResumeLayout(False)
  End Sub
  1. End Region
  " display message box and obtain dialogue button clicked
  Private Sub cmdDisplay_Click(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles cmdDisplay.Click
     Dim dialog As DialogResult = MessageBox.Show( _
        "This is Your Custom MessageBox", "Custom MessageBox", _
        buttonType, iconType)
     Select Case dialog
        Case DialogResult.OK
           lblDisplay.Text = "OK was pressed"
        Case DialogResult.Cancel
           lblDisplay.Text = "Cancel was pressed"
        Case DialogResult.Abort
           lblDisplay.Text = "Abort was pressed"
        Case DialogResult.Retry
           lblDisplay.Text = "Retry was pressed"
        Case DialogResult.Ignore
           lblDisplay.Text = "Ignore was pressed"
        Case DialogResult.Yes
           lblDisplay.Text = "Yes was pressed"
        Case DialogResult.No
           lblDisplay.Text = "No was pressed"
     End Select
  End Sub 
  Private Sub radOk_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radOk.CheckedChanged
     buttonType = MessageBoxButtons.OK
  End Sub 
  Private Sub radOkCancel_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radOkCancel.CheckedChanged
     buttonType = MessageBoxButtons.OKCancel
  End Sub 
  Private Sub radAbortRetryIgnore_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radAbortRetryIgnore.CheckedChanged
     buttonType = MessageBoxButtons.AbortRetryIgnore
  End Sub 
  Private Sub radYesNoCancel_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radYesNoCancel.CheckedChanged
     buttonType = MessageBoxButtons.YesNoCancel
  End Sub 
  Private Sub radYesNo_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radYesNo.CheckedChanged
     buttonType = MessageBoxButtons.YesNo
  End Sub 
  Private Sub radRetryCancel_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radRetryCancel.CheckedChanged
     buttonType = MessageBoxButtons.RetryCancel
  End Sub 
  Private Sub radAsterisk_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radAsterisk.CheckedChanged
     iconType = MessageBoxIcon.Asterisk
  End Sub 
  Private Sub radError_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radError.CheckedChanged
     iconType = MessageBoxIcon.Error
  End Sub 
  Private Sub radExclamation_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radExclamation.CheckedChanged
     iconType = MessageBoxIcon.Exclamation
  End Sub 
  Private Sub radHand_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radHand.CheckedChanged
     iconType = MessageBoxIcon.Hand
  End Sub 
  Private Sub radInformation_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radInformation.CheckedChanged
     iconType = MessageBoxIcon.Information
  End Sub 
  Private Sub radQuestion_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radQuestion.CheckedChanged
     iconType = MessageBoxIcon.Question
  End Sub 
  Private Sub radStop_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radStop.CheckedChanged
     iconType = MessageBoxIcon.Stop
  End Sub 
  Private Sub radWarning_CheckedChanged(ByVal sender _
     As System.Object, ByVal e As System.EventArgs) _
     Handles radWarning.CheckedChanged
     iconType = MessageBoxIcon.Warning
  End Sub 

End Class

      </source>