Solved

VB6 Not Responding

Posted on 2007-11-20
6
1,384 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
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.

 
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

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

919 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

23 Experts available now in Live!

Get 1:1 Help Now