a msgbox or window hints the programming still running
my program needs to take more than 2 min to perform the computation. I would like to remind the user that the program is still running. However, this reminding window or msgbox does not show up until the program finishes running. I guess that it did show up but did not refresh. Can anyone help me to write a correct reminding window or msgbox?
Thanks a lot.
Re: a msgbox or window hints the programming still running
Re: a msgbox or window hints the programming still running
Welcome to VBF!
You can use DoEvents to let the computer process other events. If your project has a loop, put DoEvents in like this. You should only use as many as are required. If you have too many, you will actually slow down your app.
VB Code:
Option Explicit
Private Sub Form_Load()
' You want the statement to execute only twice
' so you would use the Modulo function. This will fire
' at 50 and 100
Dim x As Integer
For x = 1 To 100
If x Mod 50 = 0 Then DoEvents
Next x
End Sub
Re: a msgbox or window hints the programming still running
Maybe a better solution would be a progress bar or some other indicator on the form that is displaying when the process is running.
A message box is a modal window, meaning your code stops and waits for the message box to be discarded before it continues processing.