English 中文(简体)
What are the benefits to using DoEvents over Repaint on a userform in VBA?
原标题:

What are the benefits to using DoEvents over Repaint on a userform in VBA? Is it due to performance, for minimising the annoyance of things such as screen flicker, or for when you need to update more than just the form?

Looking for some clarification on the difference from a VBA perspective.

最佳回答

In general, VB6 and VBA uses DoEvents to tell the processor to continue processing the messages in the message queue. It is used when an intensive processing operation is being done in the processor and so the UI of the program is still responsive to all other events.

Example: You are doing an intensive search algorithm, if you didn t add DoEvents the program may hang up till it finishes the search. On the other hand, if you add DoEvents (to the search loop let s say) the program does not hang up and still can handle all program events like (Cancel) canceling the search.

EDIT: I see it as DoEvents is more comprehensive than Repaint since it deals with all event types not only handling the flicker/Hangup of the UI.

问题回答

暂无回答




相关问题
Handling no results for docmd.applyfilter

I have an Access app where I use search functionality. I have a TextBox and a Search Button on the form, and it does a wildcard search of whatever the user enters in the TextBox, and displays the ...

Outlook 2007 CommandBarControl.Execute won t work

I recently switched to Outlook 2007 and noticed that my VBA-macros won t work. I use the following code to open a new appointment-item (and fill it automatically). It worked perfect in Outlook 2003, ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

MS Access: list macro from VBA

I have to deal with a few macros (not VBA) in an inherited Access application. In order to document them, I would like to print or list the actions in those macros, but I am very dissatisfied by ...

热门标签