New to Telerik UI for WinForms? Download free 30-day trial

Getting Started with WinForms RadioButton

You can add RadRadioButton either at design time or at run time:

Design Time

  1. To add a RadRadioButton to your form, drag a RadRadioButton from the toolbox onto the surface of the form designer.
  2. Like a standard button, you can control the displayed text by setting the Text property.
  3. Double click the RadRadioButton at design time to generate the ToggleStateChanged event.

Run Time

To programmatically add a RadRadioButton to a form, create a new instance of a RadRadioButton, and add it to the form Controls collection.

Adding RadRadioButton at run time

RadRadioButton radioButton = new RadRadioButton();
radioButton.Text = "Medium size";
radioButton.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;
this.Controls.Add(radioButton);

Dim radioButton As New RadRadioButton()
radioButton.Text = "Medium size"
radioButton.ToggleState = Telerik.WinControls.Enumerations.ToggleState.[On]
Me.Controls.Add(radioButton)

The following tutorial demonstrates creating two groups of radio buttons that act independently of one another. Choices are reflected in a label as they are selected.

WinForms RadRadioButton Adding Run Time

1. Drop two RadGroupBoxes on the form.

2. Drop three RadRadioButtons on the first groupbox. Set their Text properties to "Small", "Medium" and "Large".

3. Drop three RadRadioButtons on the second groupbox. Set their Text properties to "Latte", "Mocha", and "Hot Chocolate".

4. Drop a RadLabel on the form. Set the name of the RadLabel to "lblStatus".

5. Hold down the Shift key and select all six RadRadioButtons with the mouse.

6. Click the Events tab of the Properties Window.

7. Double click the ToggleStateChanged event to create an event handler. Replace the code with the following:

Handling the ToggleStateChanged Event

void radRadioButton1_ToggleStateChanged(object sender, StateChangedEventArgs args)
{
    lblStatus.Text = (sender as RadRadioButton).Text + " is selected";
}

Private Sub radRadioButton1_ToggleStateChanged(ByVal sender As Object, ByVal args As StateChangedEventArgs)
    lblStatus.Text = (TryCast(sender, RadRadioButton)).Text + " is selected"
End Sub

8. Press F5 to run the application. Notice that selections made on radio buttons in the panel are independent of the radio button choices on the form. RadRadioButton determines the radio groups by the control parent. All RadRadioButtons sharing the same parent e.g. RadGroupBox, RadPanel or a Form will be part of one group.

RadRadioButtons are grouped according to their parent. You can place a set of RadRadioButtons on a panel so that the choices made will be mutually exclusive, i.e. when one radio button is chosen, the others are deselected. By including multiple parents with their own RadRadioButtons you can have multiple groups of radio buttons acting independently.

Telerik UI for WinForms Learning Resources

In this article