Edit this page

Getting Started

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

Design Time

  1. To add a RadButton to your form, drag a RadButton from the toolbox onto the surface of the form designer.
  2. In the Properties section in Visual Studio change the Text property of RadButton.
  3. Double click the button to generate the Click event handler. Add the desired code to perform the required action.
  4. Click F5 to start the application.

Run Time

To programmatically add a RadButton to a form, create a new instance of a RadButton, and add it to the form Controls collection. Subscribe to its Click event in order to perform the required action, e.g. showing a message box:

Adding a RadButton at runtime

RadButton myNewRadButton = new RadButton();
myNewRadButton.Text = "My New RadButton";
myNewRadButton.Width = 150;
myNewRadButton.Height = 50;
this.Controls.Add(myNewRadButton);
myNewRadButton.Click+=myNewRadButton_Click;

Dim myNewRadButton As New RadButton()
myNewRadButton.Text = "My New RadButton"
myNewRadButton.Width = 150
myNewRadButton.Height = 50
Me.Controls.Add(myNewRadButton)
AddHandler myNewRadButton.Click, AddressOf myNewRadButton_Click

private void myNewRadButton_Click(object sender, EventArgs e)
{
    RadMessageBox.Show("Clicked");
}

Private Sub myNewRadButton_Click(sender As Object, e As EventArgs)
    RadMessageBox.Show("Clicked")
End Sub

Was this article helpful? Yes No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy