Solved

Progress Update

Posted on 1998-08-18
3
149 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel - Save a copy of work book 13 83
VBA filters 2 51
How to compare ms sql hashbytes results within vb6 5 55
VB6 ListBox Question 4 34
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

863 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

25 Experts available now in Live!

Get 1:1 Help Now