In this tutorial, you will use a Telerik RadProgressBar to show the progress
of a long-running operation. The long-running operation is simulated with a
Timer control.
- Place a RadProgressBar control, a
RadButton control, and a standard Timer
control on a form.
- Set the Timer control Interval
property to 50.
- In the Properties window, click the events
button.
- Double-click the Tick event.
- Replace the automatically-generated event handler with this code:
Copy[C#] Handling the Timer Tick event
int ticks = 0;
private void timer1_Tick(object sender, EventArgs e)
{
ticks++;
radProgressBar1.Value1 = ticks;
if (ticks == 100)
{
timer1.Enabled = false;
ticks = 0;
}
}
Copy[VB.NET] Handling the Timer Tick event
Private ticks As Integer = 0
Private Sub timer1_Tick(ByVal sender As Object, ByVal e As EventArgs)
ticks += 1
RadProgressBar1.Value1 = ticks
If ticks = 100 Then
Timer1.Enabled = False
ticks = 0
End If
End Sub - In the design view of the form, select the RadButton
control.
- In the Properties window set the Text
property to "Go!".
- In the Properties window, click the events
button.
- Double-click the Click event.
- Replace the automatically-generated event handler with this code:
Copy[C#]
void radButton1_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
}
Copy[VB.NET]
Private Sub radButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
Timer1.Enabled = True
End Sub - In the design view of the form select the
RadProgressBar control.
- Set Dash to true.
- Set Text to an empty string.
- Set SeparatorColor1 to Yellow.
- Set SeparatorColor2 to Gold.
- Set SeparatorWidth to 6.
- Set StepWidth to 12.
- Set SweepAngle to 210.
- Press F5 to run the project.
- Click the Go Button to see the Telerik RadProgressBar
animation.