Howdy, Stranger!

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

Categories

Progress Bar

staceystacey Member Posts: 72
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

  • BarkeeperBarkeeper Member Posts: 335
    : 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

  • staceystacey Member Posts: 72
    : 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!


  • DarQDarQ Member Posts: 1,625
    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]

  • staceystacey Member Posts: 72
    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?
  • DarQDarQ Member Posts: 1,625
    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]

  • staceystacey Member Posts: 72
    oki doki
  • Andre YoungAndre Young USAMember Posts: 0

    ____ // http://forcoder.org // free ebooks and video tutorials about ( Python Assembly Objective-C Visual Basic .NET MATLAB Delphi C++ PHP Swift Go Visual Basic PL/SQL C C# JavaScript Ruby Perl Java Scratch R Bash Scheme Logo LabVIEW Crystal Kotlin ML SAS Transact-SQL VBScript Hack Erlang D Ada F# Lisp ABAP Alice Fortran Dart FoxPro Scala Apex Lua Clojure Awk Prolog Julia COBOL Rust ) ________

Sign In or Register to comment.