# Getting Started with WinForms RepeatButton

This article shows how you can start using `RadRepeatButton`.

## Adding Telerik Assemblies Using NuGet

To use `RadRepeatButton` when working with NuGet packages, install the `Telerik.UI.for.WinForms.AllControls` package. The [package target framework version may vary](https://www.telerik.com/products/winforms/documentation/visual-studio-integration/available-nugets).

Read more about NuGet installation in the [Install using NuGet Packages](https://www.telerik.com/products/winforms/documentation/installation-and-upgrades/install-using-nuget) article.

> tip With the 2025 Q1 release, the Telerik UI for WinForms has a new licensing mechanism. You can learn more about it [here](https://www.telerik.com/products/winforms/documentation/licensing/license-key).

## Adding Assembly References Manually

When dragging and dropping a control from the Visual Studio (VS) Toolbox onto the Form Designer, VS automatically adds the necessary assemblies. However, if you're adding the control programmatically, you'll need to manually reference the following assemblies:

* **Telerik.Licensing.Runtime**
* **Telerik.WinControls**
* **Telerik.WinControls.UI**
* **TelerikCommon**

The Telerik UI for WinForms assemblies can be install by using one of the available [installation approaches](https://www.telerik.com/products/winforms/documentation/installation-and-upgrades/installing-on-your-computer).

## Defining the RadRepeatButton

You can add **RadRepeatButton** either at design time or at run time:

### Design Time

1. To add a **RadRepeatButton** to your form, drag a **RadRepeatButton** from the toolbox onto the surface of the form designer.
2. In the *Properties* section in Visual Studio you can change the **Text** property.
3. Double click the **RadRepeatButton** at design time in order to generate the **Click** event handler.
4. Click `F5` to start the application.

### Run Time

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

#### Adding a RadButton at runtime

```C#
RadRepeatButton repeatButton = new RadRepeatButton();
repeatButton.Text = "Increase value";
this.Controls.Add(repeatButton);
```

```VB.NET
Dim repeatButton As New RadRepeatButton()
repeatButton.Text = "Increase value"
Me.Controls.Add(repeatButton)
```

### Working with RadRepeatButton

In addition to the standard properties shared by all buttons, notice a new property named **Interval**. This property determines the time, in milliseconds, between button click events after the control begins repeating events. The default value is 33.

To begin the repeat process, use the **ButtonClick** event instead of **Click**. To create an event handler for this event, change the filter in the Property Grid to **Events** and find the entry for **ButtonClick**. Double-click in the empty value drop-down list for the property to have the designer create a method to handle **ButtonClick**.

The following code illustrates the use of a **RadRepeatButton** to manipulate a **ProgressBar** control. At each interval the **ProgressBar** value will increment. You do not need to write any additional code to handle the repeating event. As long as the mouse button is pressed down on the **RepeatButton** control, the code in the **ButtonClick** event handler will run at each interval.

```C#
void radRepeatButton1_Click(object sender, EventArgs e)
{
    if (radProgressBar1.Value1 < radProgressBar1.Maximum)
    {
radProgressBar1.Value1++;
    }
    else
    {
radProgressBar1.Value1 = radProgressBar1.Minimum;
    }
}
```

```VB.NET

Private Sub radRepeatButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
    If radProgressBar1.Value1 < radProgressBar1.Maximum Then
        System.Math.Max(System.Threading.Interlocked.Increment(radProgressBar1.Value1), radProgressBar1.Value1 - 1)
    Else
        radProgressBar1.Value1 = radProgressBar1.Minimum
    End If
End Sub

```

![WinForms RadRepeatButton Overview](https://www.telerik.com/products/winforms/documentation/assets/64f8fa6afe31288085bbcc591b40327d/buttons-repeatbutton-overview001.gif)

## Telerik UI for WinForms Learning Resources

* [Telerik UI for WinForms RepeatButton Component](https://www.telerik.com/products/winforms/buttons.aspx)
* [Getting Started with Telerik UI for WinForms Components](https://docs.telerik.com/devtools/winforms/getting-started/first-steps)
* [Telerik UI for WinForms Setup](https://docs.telerik.com/devtools/winforms/installation-and-upgrades/installing-on-your-computer)
* [Telerik UI for WinForms Converter](https://www.telerik.com/products/winforms/documentation/ai-coding-assistant/converter/converter)
* [Telerik UI for WinForms Visual Studio Templates](https://docs.telerik.com/devtools/winforms/visual-studio-integration/visual-studio-templates)
* [Deploy Telerik UI for WinForms Applications](https://docs.telerik.com/devtools/winforms/deployment-and-distribution/application-deployment)
* [Telerik UI for WinForms Virtual Classroom(Training Courses for Registered Users)](https://learn.telerik.com/learn/course/external/view/elearning/17/telerik-ui-for-winforms)
* [Telerik UI for WinForms License Agreement)](https://www.telerik.com/purchase/license-agreement/winforms-dlw-s)
