Imports System.Windows.Forms
public class RadioButtonAction
public Shared Sub Main
Application.Run(New FrmRadioButton)
End Sub
End class
Public Class FrmRadioButton
Inherits System.Windows.Forms.Form
Private iconType As MessageBoxIcon
Private buttonType As MessageBoxButtons
#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.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.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 = "AbortRetryIgnore"
'
'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 = "YesNo"
'
'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 = "YesNoCancel"
'
'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 = "RetryCancel"
'
'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 = "OKCancel"
'
'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
#End Region
Private Sub cmdDisplay_Click(ByVal sender _
As System.Object, ByVal e As System.EventArgs) _
Handles cmdDisplay.Click
Dim dialog As DialogResult = MessageBox.Show( _
"Your message", "Title", _
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 ' cmdDisplay_Click
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