My Assistant
![]()
Custom Search
|
![]() ![]() |
![]() |
![]() Post#1 | |
Posts: 322 Joined: 15-December 16 ![]() | All, I have a need to implement a progress bar. the problem is, percentages always confuse me, especially when working with larger numbers. I have a base value of 3090. that is multiplied, through a repetitive process by anywhere from 1 to 50 by a code loop. During this loop processes are completed. However, I can't work out how to divide this value into a 100 and then represent that on a bar that requires a number from 1 to 100. So lets say 3090 / 100 = 30.9. in which 30.9 = 1 tick. I'm sure the mod operator should be used, but I don't know how. Can anyone offer a suggestion with example. Cheers |
![]() Post#2 | |
![]() UtterAccess Moderator Posts: 11,907 Joined: 6-December 03 From: Telegraph Hill ![]() | What type of progress bar are you using? The built-in ActiveX, or are you creating your own? Are you saying that 3090 is your maximum value, and your increments each loop are between 1 and 50? Normally, you would just set the Max, and then increment the value. If you are rolling your own your progress bar width would be: CODE Me.lblProg.Width = (iProgVal / iMax) * Me.lblProgContainer.Width If you need to have it as a percentage the formula is: (value / max) * 100 (where max = 3090) hth, d -------------------- Regards, David Marten |
![]() Post#3 | |
![]() UtterAccess VIP Posts: 1,893 Joined: 4-June 18 From: Somerset, UK ![]() | There are many example progress bars available online. Here's one you may be able to use Progress Bar -------------------- |
![]() Post#4 | |
![]() UtterAccess VIP Posts: 4,750 Joined: 5-June 07 From: UK ![]() | with the access progress bar, you do not have to evaluate percentages. you just tell it there are 3090 entries for the full progress bar, and then count the records and pass the count to the progress bar. now for a progress bar, with 3090 entries, there are 100 stages of approximately 30 records per stage - the progress bar won't show a change for multiples below 30/31 records, ie - until the next percentage of the total count is reached - so in point of fact there is no need to update the progress bar unless count mod 30 is zero, especially as updating the progress bar takes quite a few clock ticks - but updating the progress bar for every record is simple to do. so CODE open progressbar 3090 repeat increment count update progressbar with count 'or more efficiently 'if count mod 30 = 0 then update progressbar with count until done remove progressbar -------------------- Dave (Male) (Gemma was my dog) |
![]()
Custom Search
|
![]() | Search Top Lo-Fi | 11th December 2019 - 09:10 AM |