Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423

Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 426

Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/templates/ja_purity/ja_templatetools.php on line 49
Progressbar in C# - The Scripts Library Community

Free Programming Tutorials & Source Code

 
  • Increase font size
  • Default font size
  • Decrease font size
Home C# Progressbar in C#

Progressbar in C#

E-mail
(2 votes, average: 2.50 out of 5)
The Progressbar Class is a part of the .NET framework, which provides progress bar control that can enhance your functionality of your application.
In this tutorial, we are going to use three members of the Progressbar class:
Minimum, Maximum, and Value.
The value should range between the minimum and maximum.

Create a new C# Application. Add the following controls to the main form:
Progressbar control, name it as pb.
Timer, name it as tr

progress bar

Paste the following code into the Form Load Event sub:

        private void frmProgressbar_Load(object sender, EventArgs e)
        {
            pb.Minimum = 0; // set Minimum to 0
            pb.Maximum = 100;// set Maximum t0 100
            tr.Interval = 100;// timer ticks each 100 milliseconds
            tr.Enabled = true; // start the timer
        }


and the Timer Tick Event sub:

        private void tr_Tick(object sender, EventArgs e)
        {
            if(pb.Value!=100) // check if value below 100 (should not be greater than the maximum value of the Progressbar
            {
                pb.Value += 5;// add 5 to the Progressbar current value
            }
        }


That's it!