blog

Home / DeveloperSection / Blogs / ProgressBar in C#

ProgressBar in C#

AVADHESH PATEL5209 28-Sep-2012
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.
            ProgressBarpBar = 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#


Updated 18-Sep-2014
Avadhesh Kumar Patel District Project Manager - Aligarh 14 months work experience in Panchayati Raj Department Sector as District Project Manager & 12 months work experience in IT Sector as Software Engineer. :-)

Leave Comment

Comments

Liked By