C# Progress Bar Example

In this article I will tell you about the use of C # ProgressBar. The Progressbar can take a value of 0 as Minimum and 100 as Maximum. A value other than these values can not be entered. We can see the ProgressBar everywhere. For example, we are seeing ProgressBars that tell us when to load a program. Writes are written on it as 80% complete and this percentage is visually displayed to us on the progressbar. We usually use the ProgressBar to do things that keep us waiting too long. The use of the Progressbar is very simple. There are various types of usage. Now let’s examine a few uses;

  • First, let’s do a program that increments the ProgressBar ‘in value by 10 each time we click on the button. First we add one button and one ProgressBar to our form.

  • Click button the progress bar status will increase

C# Progress Bar Features

Enabled: Enables the Progress Bar object to be active or passive. True to be active, False to be passive. These properties can be edited in the Properties panel or can be specified in code. For example; the Progress Bar object can be activated with the code “progressBar1.Enabled = true;” when a button is clicked.

Maximum: This property specifies the number of times the Progress Bar object will be divided. It is the upper limit of the range of the progress bar. The default value is set to 100. For example; For each Progress Bar object whose Maximum property is set to 10, 1/10 of the progression of each button can be provided.

Minumum: The smallest working value of the progress bar. A value value can not be assigned to the progress bar below this value. Otherwise, the program will fail. For example; An error occurs when the code “ProgressBar1.Value = 8;” is written to a Progress Bar object with a minimum value of 10.

Value: The current value of the progress bar in the range specified by the minimum and maximum specifications. In other words, the Progress Bar object is a feature that determines how much to fill graphically. The Value value can not exceed the value specified by the Maximum property of the progress bar.

Example of Value Property: In the example, a progress bar with a minimum value of 0 and an maximum value of 100 is controlled by four buttons.

Progress Bar Style

Style: Progress Bar is the property that determines the working style of the object. Blocks, Continuous and Marquee should be selected. The feature that stands out here is the Marquee feature. With this feature, you can also use the Timer object to design a progress bar that shows the animation feature at the desired time. Animation speed is set by selecting MarqueeAnimationSpeed property on the Properties Window pen when Progress Bar is selected.

  • Marquee ProgressBar Style Example:

  • This will be a floating ProgressBar when we start the program after adding this code

C# Progress Bar Changing Color

Fore Color: The progress bar is the foreground color, that is, the part of the progress bar that is filled.

Back Color: Background color of the progress bar.

After we write our codes, there is one more thing we need to do. In the Solution Explorer window, double-click on the “Program.cs” File.

we either delete the line or make it into the description line as shown below.

C# ProgressBar Timer Use

Timer control in C # applications is used to ensure that the desired commands are repeated at specified time intervals.

Start: Starts the Timer object.

  • Add timer to my project

  • We reset the value after the timer expires



if you have question do not forget to write from the chat button next to it or from the comment


You may also like...

2 Responses

  1. Doshi Tirth says:

    how can i pause and resume the progress bar in C# if anybody have idea help.

    • Taha Sıvacı says:

      You can see how to stop and continue by putting a button, progressbar and timer as in the example code I gave below.

Leave a Reply

Your email address will not be published.