[RESOLVED] [2005] Using a basic progress bar accurately
Hello everyone,
Is there any standard formula that can help in making a progressbar move accurately according to any value?
Say if I have a value of 2315,what formula is generally used to make it equivalent to 100% and make the progressbar step according to the progress made to reach that value?
For example,imagine your program would send email to people on your address book,if the address book contains 2412 email addresses,how can it show the progress bar move accurately?
Can someone help me?
Thanks
Re: [2005] Using a basic progress bar accurately
Set the Max property of the progressbar to 1245. This will make a value of 622.5 or so exactly 50% of the progressbar, for example.
Re: [2005] Using a basic progress bar accurately
Thanks Rob :) but,how can it show the exact progress from 1,2,3,4 and so on? i mean how does it work on other applications?
Re: [2005] Using a basic progress bar accurately
For example,imagine your program would send email to people on your address book,if the address book contains 2412 email addresses,how can it show the progress bar move accurately as the email finishes sending to all the recipents depending on whatever the number?
Re: [2005] Using a basic progress bar accurately
What ever is your progress, looping for example, you would know the number of iterations and then divide the max by the number of iterations. Then increment in each loop by that number.
Re: [2005] Using a basic progress bar accurately
Quote:
Originally Posted by uniquegodwin
For example,imagine your program would send email to people on your address book,if the address book contains 2412 email addresses,how can it show the progress bar move accurately as the email finishes sending to all the recipents depending on whatever the number?
Yes, for each email just increase the Value of the progressbar by its current value plue one.
VB Code:
For i As Integer = 1 to 1245
'Send Email code
Me.Progressbar1.Value = Me.Progressbar.Value + 1
Next
Re: [2005] Using a basic progress bar accurately
Would it be possible for you to give an example? :s
VB Code:
For i= 1 to 1234
progressbar.value+=1?
Next i
Re: [2005] Using a basic progress bar accurately
For a more complete example...
VB Code:
Me.Progressbar1.Value = 0
Me.Progressbar1.Max = 1245
For i As Integer = 1 to 1245
'Send Email code
Me.Progressbar1.Value = Me.Progressbar.Value + 1
Next
There i not much more to it then that unless I am misunderstanding you?
Re: [2005] Using a basic progress bar accurately
If you have N things to do then you set the Maximum to N, the Step to 1 and call PerformStep each time you do something. If each operation doesn't have the same value then you can set the Value property explicitly but it's preferred to call PerformStep if each step is of equal value.
Now, there are various ways to calculate progress. If you have 10 things to do and one of them takes an hour while the others take 1 minute each then 10 equal steps doesn't really cut it. It really depends on what you're doing as to what is the best way to calculate the current progress.
Re: [2005] Using a basic progress bar accurately
Specifying Step is optional if the iteration is performed in increments of 1.
For this if the emails are all the same but with different verbiage then it should be close to accurate. But if there is any network connection issues or times of high network resource use then it will vary. Also, if there are differences in the emails like attachment count/size then it will vary even more.
Re: [2005] Using a basic progress bar accurately
Re: [RESOLVED] [2005] Using a basic progress bar accurately
Yes you're bad! (post #2) :D ;)
Re: [RESOLVED] [2005] Using a basic progress bar accurately
yeah...surely..:)
sorry i edited it,cos sounded embarassing
Re: [RESOLVED] [2005] Using a basic progress bar accurately
I'm willing to take credit for your advice Rob, so make sure it's good advice because I don't want to steal credit for any old rubbish. ;)
Re: [RESOLVED] [2005] Using a basic progress bar accurately
So if its bad advice then you will take credit for that as its not old. :D