Home > DeveloperSection > Articles > Using Progress Bar Status Bar Timer Control in CSharp .NET

Using Progress Bar Status Bar Timer Control in CSharp .NET

C# C# 
0 Comment(s)
 7241  View(s)
Rate this:

Using ProgressBar, StatusBar and Timer Controls in .NET

Here I’m going to demonstrate how to use Progress Bar, status Bar and Timer controls in C#.Net



//creating method getTime() to get current system time.

string getTime()


            string time = "";

            time = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();

            return time;



//executing progress bar at button click event.

        private void btnLoad_Click(object sender, EventArgs e)


            for (int i = progressBar1.Minimum; i <= progressBar1.Maximum; i++)


//displaying ‘loading...’ in status bar

                statLabel.Text = "loading...";




            statLabel.Text = "Loading Complete";



        private void Form2_Load(object sender, EventArgs e)


//setting timer interval to 1sec

            timer1.Interval = 1000;

//enabling timer

            timer1.Enabled = true;

//seting minimun limit of progress bar

            progressBar1.Minimum = 1;

//seeting maximum limit of progress bar

            progressBar1.Maximum = 1000000;

//setting step

            progressBar1.Step = 1;           

//displating current time in label

            label1.Text = getTime();



//updating label text every sec. to display current time at timer tick event.

        private void timer1_Tick(object sender, EventArgs e)


            label1.Text = getTime();


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

Follow MindStick