Home > DeveloperSection > Blogs > ProgressBar in C#

ProgressBar in C#


C# C# 
Ratings:
1 Comment(s)
 3047  View(s)
Rate this:
A ProgressBar control is used to represent the progress of a lengthy operation that takes time where a user has to wait for the operation to be finished.

Here I used ProcessBar Dynamically.

using System;

using System.Windows.Forms;

namespace ProcessBar

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

         private void btnStart_Click(object sender, EventArgs e)

        {

            //creating a dynamic ProgressBar is to create an instance of ProgressBar class.

            ProgressBar pBar = new ProgressBar();

                 //name of process bar

            pBar.Name = "progressBar1";

             // set height and width of processbar

            pBar.Width = 200;

            pBar.Height = 20;

             //add the ProgressBar to a Form. 

            Controls.Add(pBar);

             //The Dock property is used to set the position of a ProgressBar

            pBar.Dock = DockStyle.Bottom;

             //The Minimum and Maximum properties define the range of a ProgressBar

            pBar.Minimum = 0;

            pBar.Maximum = 100;

             //The Value property represents the current value of a ProgressBar.

            pBar.Value = 70;

        }

    }

}

Output


ProgressBar in C#

By Rohit Kesharwani on   4 years ago
niceblog.

Don't want to miss updates? Please click the below button!

Follow MindStick