Getting Started with WinForms Button
You can add RadButton either at design time or at run time:
Design Time
- To add a RadButton to your form, drag a RadButton from the toolbox onto the surface of the form designer.
- In the Properties section in Visual Studio change the Text property of RadButton.
- Double click the button to generate the Click event handler. Add the desired code to perform the required action.
- 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
Telerik UI for WinForms Learning Resources
- Telerik UI for WinForms Button Component
- Getting Started with Telerik UI for WinForms Components
- Telerik UI for WinForms Setup
- Telerik UI for WinForms Application Modernization
- Telerik UI for WinForms Visual Studio Templates
- Deploy Telerik UI for WinForms Applications
- Telerik UI for WinForms Virtual Classroom(Training Courses for Registered Users)
- Telerik UI for WinForms License Agreement)