Encapsulates a standard Windows radio button (option button).
Object
MarshalByRefObject
MarshalByRefComponent
Control
RichControl
ButtonBase
RadioButton
[Visual Basic] Public Class RadioButton Inherits ButtonBase [C#] public class RadioButton : ButtonBase [C++] public __gc class RadioButton : public ButtonBase [JScript] public class RadioButton extends ButtonBase
The RadioButton control may display text, an Image, or both.
When the user selects one radio button within a group, the others clear automatically. All RadioButton controls in a given container, such as a form, constitute a group. To create multiple groups on one form, place each additional group in its own container such as a GroupBox or Panel control.
RadioButton and CheckBox controls have a similar function: they offer choices a user can select or clear. The difference is that multiple CheckBox controls can be selected at the same time, but radio buttons are mutually exclusive.
Use the Checked property to get or set the state of a RadioButton. Use the Appearance property to allow the control to support an image and have the appearance of a button.
Namespace: System.WinForms
Assembly: System.WinForms.dll
The following example instantiates a RadioButton, gives it the appearance of a toggle button, and sets its AutoCheck property to false.
Private Sub MySub() ' Initialize a new RadioButton. Form1.RadioButton1 = New System.WinForms.RadioButton ' Make the radio button control appear as a toggle button. RadioButton1.Appearance = Appearance.Button ' Turn off the update of the display on the click of the control. RadioButton1.AutoCheck = False ' Add the radio button to the form. Form1.Controls.Add(RadioButton1) End Sub
RadioButton Members | System.WinForms Namespace | ButtonBase | Button | CheckBox