C# Progress Bar TutorialC# Progress Bar Tutorial

Ok so as I explained above we are going to be writing a program in Visual C# that allows a progress bar to advance by button click or by a timer that we have set up.

1.First thing we want to do is open up our Visual Studio or C# Express Edition which you can download from Microsoft's website. Please note that Dreamspark users are allowed to download a free copy of Visual Studio from their campuses online store. Dream Spark is for Students currently enrolled in some kind of education

2.Second your going to want to create a new project and name it whatever you see fit I named mine C Sharp tutorial 1

3.Make a button by opening the tool box which should be located on the left side of the Visual Studio/C# Express Edition Interface and double click on it. Next scroll down and find the progress bar in the tool box and double click it.

4.Set it up the way you like the form to look like you want it to. What i usually do is decrease the Height and increase the width.

5.Double click the button and under the button1_click type

progressbar1.Minimum = 0; 
progressbar1.Maximum = 100; 
progressbar1.Step = 1; 

Now basically - progressbar1.Minimum is the least amount that the progress bar can reach and the progressbar1.Maximum is the highest amount that the progress bar can get to.

progressbar1.Step is basically saying that every time you click the button its going to perform a step so you would have to click the button 100 times.

6.Next go back to the Form.cs [Design] and go to the tool box and scroll down to the timer and double click it. Now if you go over to the Properties Panel it shows interval. Basically what an interval is, is that every tick of the timer its going to advance by whatever we set it to. Enabled is basically telling you that the timer is going to start off until you enable it.

7. Next double click the button and delete the code that you just wrote and type

timer1.Enabled = true;

basically this is saying to start the timer when the button is clicked

8. Go back to the Form.cs[Design] and double click on the timer button which should be located at the bottom of the Interface. Now the code your about to see is going to look extremely familiar. You are going to want to type

progressbar1.Minimum = 0; 
progressbar1.Maximum = 100; 
progressbar1.Step = 1; 

And hit debug now you'll see that it advances as soon as you hit the button. Now if you want to make it go by faster you can change the progressbar1.Step = 1; to progressbar1.Step = (Whatever Number you like);

by Peyton Lee
References and Bibliography
I am a student that enjoys writing tutorials for my users. Every so often well create a HUGE program that uses all the other little tutorials we used before probably about every 5 tutorials. So stay tuned and make sure you subscribe my to my YouTube channel so you can stay on top of my tutorials Thanks. http://www.youtube.com/watch?v=wlb0obf0QII
Rated:NR/0 Votes
Add To My Article Reading List
Add To My Article Reading List
Print Article
More Article By Peyton Lee
More Article by Peyton Lee
More Articles From C#
More Articles From C#
Related Articles and Readings
The Truth Behind The Limits What Minimum and Maximum Bets Are About By: Bill Edge
Have you ever thought about the reason behind the existence of minimum and maximum bets? The truth is simple: casinos want your money. As simple as that. So they restrict your possibilities to win. It was in 1654 that Antoine Chevalier de Mere asked Pascal why he usually lost when ...
The First Step By: Skye Thomas
Today is an anniversary of sorts for me. Three years ago today, I publicly launched Tomorrow's Edge after years of getting ready, talking about how I was someday going to do it, and researching everything but advertising! It was a huge first step in the middle of a ...
Slot Machine Odds By: Tom McBroom
It probably more appropriate to call slot machines entertainment than gambling, as the house always - and we mean always - has an edge with slot machines.The average slot machine payout ranges from an average of 85% to 99% of all coins bet. The lower the denomination ...
How to Affect Laws of Attraction For Maximum Success By: Chris D'Cruz
Everyone wishes to affect success in everything they put their minds to do In today's world an individual status is generally appraised by the number of successful activities the individual has ...
Cordless Blowers By: Ken Marlborough
Cordless Blowers are portable units normally intended for homeowners in indoor or light duty outdoor maintenance. Even though they are less powerful in comparison to gas-powered or electric-powered blowers, they are perfect for sawdust or grass clippings.The majority of cordless blowers are lightweight, since they require no cord or gas ...
The information provided in this article and/or the comments is the sole responsibility of their respective authors and does not necessarily reflect the opinion of ezinepost.com. ezinepost.com  does not endorse any article and/or comments published by our web users unless otherwise noted. 

Member Panel

login to submit articles and more


  • » Active Categories: 419
  • » Active Articles:252603
  • » Active Authors:31917
  • » Active Members: 38237
  • » Statistics Updated:
    - Tue Sep 1st, 2020 09:28AM EST