Hi everyone,
For about ten years I have had a "Please wait" style form that I use to keep the user informed when they are waiting for some long running operation to be completed.
I might update this multiple times during a process.
"Downloading results"
"Calculating totals"
"Reticulating splines"
etc.
Public Function PleaseWait(PleaseWaitText As String)
[Forms]![XFrmPleaseWait].Visible = True
[Forms]![XFrmPleaseWait].[LblCurrent].Caption = PleaseWaitText
DoEvents ' prevent black screens
Forms.XFrmPleaseWait.Repaint
End Function
So I am calling PleaseWait multiple times during long operations. Each time my PleaseWait routine is called, the text is updated and I repaint the form to make sure the update is seen, and this has worked flawlessly for a long, long time.
Starting at some point in the last year maybe, when using this function, the whole of the rest of the application will now to go a black screen, and only the "Please Wait" form would show against a black background. To resolve this, I added a "DoEvents" immediately prior to the repaint which fixed the issue.
However, DoEvents is having other undesirable consequences. Specifically it seems to be causing Form_Timer events to fire which are meant to be paused by the ongoing process.
So my question is - is there anything else I can replace DoEvents with which will prevent black screens, but not cause the rest of the application to actually run any other code?
For about ten years I have had a "Please wait" style form that I use to keep the user informed when they are waiting for some long running operation to be completed.
I might update this multiple times during a process.
"Downloading results"
"Calculating totals"
"Reticulating splines"
etc.
Public Function PleaseWait(PleaseWaitText As String)
[Forms]![XFrmPleaseWait].Visible = True
[Forms]![XFrmPleaseWait].[LblCurrent].Caption = PleaseWaitText
DoEvents ' prevent black screens
Forms.XFrmPleaseWait.Repaint
End Function
So I am calling PleaseWait multiple times during long operations. Each time my PleaseWait routine is called, the text is updated and I repaint the form to make sure the update is seen, and this has worked flawlessly for a long, long time.
Starting at some point in the last year maybe, when using this function, the whole of the rest of the application will now to go a black screen, and only the "Please Wait" form would show against a black background. To resolve this, I added a "DoEvents" immediately prior to the repaint which fixed the issue.
However, DoEvents is having other undesirable consequences. Specifically it seems to be causing Form_Timer events to fire which are meant to be paused by the ongoing process.
So my question is - is there anything else I can replace DoEvents with which will prevent black screens, but not cause the rest of the application to actually run any other code?