Solved

VB6 Not Responding

Posted on 2007-11-20
6
1,375 Views
Last Modified: 2008-02-01
I have an application that is sometimes required to process large sets of data.  While processing the status bar indicates the application's progress.

With larger datasets, the application becomes quite busy and appears to end-users as though it has stopped responding (them: did it crash? me: no).

With the current design, I *do not* want to use DoEvents:
- I do not want other events to be triggered
- I just want to avoid the title bar turning white (a signal of a 'Not Responding' application).

An example of the situation would be looping through a large set of data (from a map recordset) and populating a grid, or combobox with the data while displaying the progress in a status bar.

Thoughts (other than abandoning VB6)?
0
Comment
Question by:mecdesign
6 Comments
 
LVL 12

Expert Comment

by:Jeff Darling
ID: 20324594
it probably just needs to be forced to repaint periodically.  

progressbar1.refresh

I wouldn't put the refresh in after updating the progressbar1.value because then the progressbar will have a weird flicker to it. Maybe put it in a timer so that it only refreshes every once in a while to prevent flicker?
0
 
LVL 18

Accepted Solution

by:
Sethi earned 500 total points
ID: 20324694
You can also place a label control that says please wait while the processing is on and use a timer to make that label go on and off. This will make the user feel that something is on.
0
 
LVL 2

Expert Comment

by:andrewneely
ID: 20327563
you could try a me.refresh every so many iterations

Although it does slow down execution, I would be tempted to use doevents otherwise the system might be very sluggish for the user.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 17

Expert Comment

by:Shanmuga Sundaram
ID: 20328412
if your only problem is that your system slows down while using doevents then try using the doevents like this as given below function.

Private Declare Function GetQueueStatus Lib "user32" (ByVal qsFlags As Long) As Long

Function DoEvents2()
If GetQueueStatus(255) <> 0 Then DoEvents
End Function
or else

Try using a label control which updates as Sethi said
0
 

Author Comment

by:mecdesign
ID: 20328828
Currently, as the status is updated, I force the lable to update as well, eg:

...
frm.StatusBar.Panels(panelIndex).text = message
frm.StatusBar.Refresh
...


When the system is very busy and the interface locks up, the refresh command has no effect.

I am sure DoEvents would fix this, but there are known issues allowing user-generated events when processing certain things.  I will spare the details.

I will try combining some of the suggested ideas and see how that works and update you later with the results.  

If there are any other suggestions, they are welcome.
0
 

Author Comment

by:mecdesign
ID: 20412212
Since I cannot use DoEvents I will accept the alternative.

Thanks.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…

746 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

13 Experts available now in Live!

Get 1:1 Help Now