Progress Bar

hello :)

I have a progress bar in my form and i'd like it to show me the time it takes for a background process to complete.
Basically, when i hit a command button this calls a sub that calculates some stuff and takes a few seconds.
The actual length of time depends on the user input, so say it changes by 10 secs if the user inputs 500 instead of 10 which is almost instantenous.

Does anyone know how to do this?
Thanx a lot :)

stacey

Comments

  • : hello :)
    :
    : I have a progress bar in my form and i'd like it to show me the time it takes for a background process to complete.
    : Basically, when i hit a command button this calls a sub that calculates some stuff and takes a few seconds.
    : The actual length of time depends on the user input, so say it changes by 10 secs if the user inputs 500 instead of 10 which is almost instantenous.
    :
    : Does anyone know how to do this?
    : Thanx a lot :)
    :
    : stacey
    :
    :

    If your calculation is going through a loop, you can do like this:

    progressbar.min=0
    progressbar.max=LoopEndCount

    inside the loop:

    do until counter=LoopEndCount
    progressbar.value=counter

    counter=counter+1
    Loop
    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein

  • : If your calculation is going through a loop, you can do like this:

    Hi,

    Well, i don't actualy have one loop (have lots of little ones). And i suppose trying to approximate a time would definately depend on the coputer's performance so even if i approximated the time on my pc it would probably be very different on another.

    Maybe i can put a little animation instead. Does anyone have any nice .avi of a little calculator vibrating or something?? Hehe...
    Thanx anyway!


  • Vibrating huh?? Ha, it is possible to calculate the ETA as well!

    First you must know how many calclations you have. 10 for example.

    Now, calculate the time of the first calculation by doing:

    lngTime = Timer
    ' calculate some stuff
    lngTime = Timer - lngTime (Note: during calculation the timer may reset to 0 when it reaches it's max.)

    Now you have the time for the first calculation.

    The rest is simple, multiply it with the number of calcs and decrease it with the first time index after every calc you make.

    You i doubt it will be needed. Most cpu's are very fast and have no problems with small or normal calcs. Unless your calc is huge!

    Is this ok for yo?

    : : If your calculation is going through a loop, you can do like this:
    :
    : Hi,
    :
    : Well, i don't actualy have one loop (have lots of little ones). And i suppose trying to approximate a time would definately depend on the coputer's performance so even if i approximated the time on my pc it would probably be very different on another.
    :
    : Maybe i can put a little animation instead. Does anyone have any nice .avi of a little calculator vibrating or something?? Hehe...
    : Thanx anyway!
    :
    :
    :

    [HR]
    [CODE]
    Wot tinkst no wol wr fn my?
    Do mast dy in kear dyn stomme bek tigt hlde.
    Oars mat ik mem Jelsma es op dy wstjoere!
    [/CODE]
    [HR]

  • Well, it's not really a calculator operation. The process which i want to apply the progress bar to involves various other applications such as opening a database file, reading and writing in it, calculating various variable arrays, just lots of different things. So it's hard to put a timer on opening a file or starting a database connection along with everything else. That's why the animation may be good in this particular case.

    I mean... it doesn't have to be a calculator vibrating. It could be for example a little character scribbling on a piece of paper or something. ummmm, got any?
  • Euh, i got a lot of virbrating stuff around but no AVI's for that. However, the Visual Studio package includes some of those! And the Internet is the biggest resource for that! So finding Avi's on the net is not so hard.

    : Well, it's not really a calculator operation. The process which i want to apply the progress bar to involves various other applications such as opening a database file, reading and writing in it, calculating various variable arrays, just lots of different things. So it's hard to put a timer on opening a file or starting a database connection along with everything else. That's why the animation may be good in this particular case.
    :
    : I mean... it doesn't have to be a calculator vibrating. It could be for example a little character scribbling on a piece of paper or something. ummmm, got any?
    :

    [HR]
    [CODE]
    Wot tinkst no wol wr fn my?
    Do mast dy in kear dyn stomme bek tigt hlde.
    Oars mat ik mem Jelsma es op dy wstjoere!
    [/CODE]
    [HR]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories