-
When I quit my program I want to wait until a function (already running) finishes.
How do I do this? What I did have was:
Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
gvMonitor.Stop = True
Close #1
do while gvstatus.monitor=true
End Sub
when my function finishes it sets gvstatus.monitor=false
However when I run this my program spends all its time in the checking loop in QueryUload and no time finishing my function.
I have tried putting a DoEvents in the loop, but unsuprisingly this did`nt make any difference.
Any ideas?
What I really need is some way of letting the background function process while checking it on the foreground
Thanks for any help
-
Rick,
In your Unload Event:
Code:
If gvstatus.monitor=true Then
Cancel = True
Exit Sub
In your function:
Code:
gvstatus.monitor = false
Unload Form1
Wade