Click here to Skip to main content
15,881,757 members
Articles / Programming Languages / Visual Basic
Article

Percent Progress Bar

Rate me:
Please Sign up or sign in to vote.
2.78/5 (14 votes)
6 Jan 20061 min read 117.9K   3.9K   19   16
A project and source code for a progress bar with percentage completed shown.

Introduction

When I first started programming, maybe about two years ago, I was disappointed to see that library code for a simple matter of having a progress bar with the percent complete inscribed in the middle, was nowhere to be found. Maybe, I am the only one who wants to have it, but I decided to make one of my own to figure out how to do it, and just for kicks.

Background

I had no idea where to start, so I checked out MSDN, and lo and behold, they had an article on how to make a progress bar control. So I used that source to create the basic control, then spent about an hour figuring out how to calculate the percent and show it in the middle of the custom bar. Sounds easy enough, eh? It took a bit, since it was my first control, but now it works.

Using the code

This is not that hard to use at all. Add it to your toolbox (Tools-> Add/Remove Toolbox Items-> Browse-> my DLL) and plop it on your form. Acts like a normal progress bar should, it just tells you how close it is to being done. Then you just use it however you like. I got the code to separate my properties from the normal .NET properties, from: A Smooth ProgressBar for everyone! Part Duex.

Points of Interest

This is a great project to look at if you are interested in learning how to create a custom control. All the code is commented, so it should not be hard to understand :-).

History

  • v 1.0 - Beginning stuff, more to come later.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
I am iwdu15, a college frosh who will be majoring in Computer Science. I use VB.Net, C#, C++, J#, Java, and some C.

Comments and Discussions

 
GeneralLicense for Percent Progress Bar Pin
Karthik LFI10-Jun-09 4:02
Karthik LFI10-Jun-09 4:02 
GeneralUseful Tipp Pin
InCodeVB21-Apr-09 4:48
InCodeVB21-Apr-09 4:48 
Hy anyone

I think you forgot this in the Constructor:

SetStyle(ControlStyles.OptimizedDoubleBuffer,True) 


Its help to supress flickring when the control is Draw.
Another tipp: divide is very slow as CPU instruction, better is to use multiple...

e.g.

50% = 0.5 * 100

in case of

100 / 2
GeneralNot the native component Pin
Jeroen De Dauw4-Feb-09 1:57
Jeroen De Dauw4-Feb-09 1:57 
QuestionPercent Progress Bar Expiration Pin
robertaallan24-Jul-08 9:55
robertaallan24-Jul-08 9:55 
AnswerRe: Percent Progress Bar Expiration Pin
sokket24-Jul-08 12:34
sokket24-Jul-08 12:34 
GeneralGood work! Pin
jometrv4-Mar-08 17:53
jometrv4-Mar-08 17:53 
GeneralProgress bar does not update in the for loop Pin
SoftwareDeveloperS29-Oct-07 10:54
SoftwareDeveloperS29-Oct-07 10:54 
GeneralRe: Progress bar does not update in the for loop Pin
iwdu15030-Oct-07 9:39
iwdu15030-Oct-07 9:39 
GeneralUrgent help Pin
jack.pro18-Jul-07 23:52
jack.pro18-Jul-07 23:52 
GeneralProgress bar Pin
Member 394446020-Mar-07 22:53
Member 394446020-Mar-07 22:53 
GeneralHaving problem. Pin
Vb.Sweat14-Feb-07 6:39
Vb.Sweat14-Feb-07 6:39 
GeneralRe: Having problem. Pin
iwdu15014-Feb-07 12:18
iwdu15014-Feb-07 12:18 
Generalwhere is the project file Pin
maxmaster27-Sep-06 12:32
maxmaster27-Sep-06 12:32 
GeneralRe: where is the project file Pin
KelvinLam3-Dec-06 3:54
KelvinLam3-Dec-06 3:54 
GeneralNice Pin
5150.Net28-Jul-06 10:45
5150.Net28-Jul-06 10:45 
GeneralRe: Nice Pin
iwdu15028-Jul-06 18:38
iwdu15028-Jul-06 18:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.