Solved

Progress Update

Posted on 1998-08-18
3
148 Views
Last Modified: 2010-04-30
I have an CPU intensive VB app. that needs a progress display.  I don't no what my final values will be so I think a meter is out of the question. My main loop will run about 60K times. I tried putting a .Refresh in the loop but
it is flickery and slowed down my app dramatically.  I tried having it refresh every 5th time, never completed the refresh even once...  I need a veryyyy simple progress indicator that won't eat alot of cpu cycles and won't flicker.
0
Comment
Question by:jimmy3
3 Comments
 
LVL 1

Accepted Solution

by:
blwatkins earned 200 total points
ID: 1429608
Try putting a DoEvents directly after your refresh statement every 5th time.

0
 
LVL 3

Expert Comment

by:schworak
ID: 1429609
Well, you might do a DOEVENTS every 30th pass through the loop. Or a combination of a refresh and doevents. It really depends on what it is you are trying to get done. The DOEVENTS won't cause a flicker, but the refresh will almost always.

My personal preference is to do a DOEVENTS/REFRESH combo (doevents always goes last) every Nth second.

Example:

dim t as double
    :
    :
t=timer+5  ' t is 5 seconds into the future
 do while (bla = true)      ' <----- what ever your loop is
        :
        :
        :
    if t<timer then
        me.refresh        ' may not be needed in your situation
        doevents
        t=timer+5         ' 5 more seconds in the future
    endif
loop

This is really low CPU time except for that once each 5 (or what ever) seconds)
0
 

Author Comment

by:jimmy3
ID: 1429610
Can i split points i got the technically correct answer first,
then i got a more detailed comment that i would really consider a good answer.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now