You are on page 1of 10

Visual Programming

Progress Bar
LAB 9

Muhammad kamran
Email: kamran_comsian@ymail.com
ProgressBar control
• A ProgressBar control is used to represent the
progress of a lengthy operation that takes
time where a user must wait for the operation
to be finished.

2
Creating a ProgressBar

• We can create a ProgressBar control using a


Forms designer at design-time or using the
ProgressBar class in code at run-time

3
Design-time

• To create a ProgressBar control at design-time,


you simply drag a ProgressBar control from
the Toolbox and drop onto a Form in Visual
Studio.
• After you the drag and drop, a ProgressBar is
created on the Form;
• for example the ProgressBar1 is added to the
form and looks as in Figure 1.

4
Design-time

5
Setting ProgressBar Properties
• After you place a ProgressBar control on a
Form, the next step is to set the properties.
• The easiest way to set the properties is from
the Properties Window.
• You can open the Properties window by
pressing F4 or right-clicking on a control and
selecting the "Properties" menu item.
• The Properties window looks as in Figure 2.

6
Setting ProgressBar Properties

7
Minimum, Maximum, and Value

• The Minimum and Maximum properties define the range of a ProgressBar. The
Value property represents the current value of a ProgressBar. The current value of
the ProgressBar for the minimum value is the color green to show the progress of
the control. We can also use the Value property to show the progress of an
operation.

• C# Code:

• pBar.Minimum = 0;

• pBar.Maximum = 100;

• pBar.Value = 70;

8
A ProgressBar with a value looks as in Figure 3.

9
Questions?

You might also like