Well, Arvin2006, it all depends on the application in question, and the code in its Form_Load or Sub Main (depending on which you use to load the application). I'm assuming you mean a progress bar on something like a splash screen.
The trick to setting up a progress bar to indicate how much of an application has loaded is to divide the code which loads the application into distinct parts. From there, you can decide how much to increment the progress bar as each part completes.
For example, suppose I have an application that loads in four parts: reading in registry values, loading one or more plugins, initializing variables and objects, and arranging/displaying the interface. I know that the parts that will take the longest are the second and third, and that they will take much longer than the other two parts to complete, so I decide not to make the progress bar range from 0 units to 4 and have each part worth 1unit - which would make each part fill 1/4 of the progress bar. Instead, I will assign the first and last parts a value of 1 unit each, and the second part a value equal to the humber of plugins I have to load.
For the third part, I will have to do some guessing and estimation. How long will it take to initialize each variable? How long will it take to create and initialize each object? What portion of the entire load time will each variable and object take up? Based on that information, I divide my variables and objects into smaller groups, and assign each group a value of 1. The progress bar now ranges from 0 to 2 + the number of plugins + the number of variable/object groups.
Now, I add a bit of code to my loading process which will bump the progress bar up by 1: after part one finishes, after each plugin is loaded, after each variable/object group is initialized, and after part four is finished. The splash screen with the progress bar on it is set up to unload itself when the progress bar reaches its maximum value.
Of course, the way you break up your progress bar is entirely up to you, and will vary from program to program. But hopefully this gives you an idea of what you need to do to pull this off. Good luck, and enjoy!
- Sendoshin