Assembly: System.Windows.Forms (in system.windows.forms.dll)
[ComVisibleAttribute(true)] [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] public class RadioButton : ButtonBase
/** @attribute ComVisibleAttribute(true) */ /** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ public class RadioButton extends ButtonBase
ComVisibleAttribute(true) ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) public class RadioButton extends ButtonBase
The RadioButton control can display text, an Image, or both.
When the user selects one option button (also known as a 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 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 option buttons are mutually exclusive.
Use the Checked property to get or set the state of a RadioButton. The option button's appearance can be altered to appear as a toggle-style button or as a standard option button by setting the Appearance property.
The following code example creates and initializes two RadioButton controls in a GroupBox. To run this example, paste the code into a Windows Form. Call InitializeRadioButtons from the form's constructor or the Load event-handling method.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.