.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson
Eminent IT

Home >> Code Snippets >> Performace >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Progress Bar

Posted By:Nikhil Kumar       Posted Date: January 12, 2010    Points: 10    Category: Performace    URL: http://www.dotnetspark.com  

This code snippets shows you the work of Progress bar in c# .NET GUI

A ProgressBar control is used to display the progress of some activity.

The attached application creates a ProgressBar and shows the server activity. The project is developed using C#, Windows Forms, and Visual Studio 2005.

The UI of the application looks like following.

The source code is listed below.

As you can see below, I add a timer control to the form and on the timer tick event handler, I increament the value of the progressbar.

Download the attached project for more details.

namespace Progress_Bar
    public partial class Form1 : Form
        public Form1()

        // Call the function of tick event of the timer:_...
        // Set the timer Intervel at 60:_
        // Set the timer enabled "True" by the timer properties:_
        private void timer1_Tick(object sender, EventArgs e)

        //Create the function for progress bar:_
        public void fn_prbar_()
            label1.Text = "Connecting to server_  "  + progressBar1.Value.ToString() +  "%";
            if (progressBar1.Value == progressBar1.Maximum)
                MessageBox.Show("Server has been connected");

Nikhil Kumar


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend