Re: do pop up boxes stop all events?
- From: "tadamsmar@xxxxxxxxx" <tadamsmar@xxxxxxxxx>
- Date: Wed, 19 Sep 2007 05:26:43 -0700
On Sep 19, 6:00 am, "Mike Williams" <mi...@xxxxxxxxxxxxxxxxx> wrote:
<tadams...@xxxxxxxxx> wrote in message
news:1190161756.664421.29960@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
See above you said: "only the code in the Sub
that displayed the MsgBox will be halted"
Have a look at the response I've just posted (twenty minutes or so before
this one).
but the public Sub (a different Sub) called from
main is also halted.
I meant that code in /events/ will still work while the MsgBox is displayed,
and the events will still continue to be generated, so any code they contain
will still be actioned. The code in the Sub that caused the MsgBox to appear
will stop, exactly as I've said, but other code in other events will
continue to work (at least other code that is not itself waiting for
termination of the code that caused the MsgBox to appear).
In your specific case you appear to be running a tight loop in a block of
code in a sub (Main?) and the code in that sub appears to contain some
DoEvents (so that the user can still react with your Forms). That is not
really the way to tackle most jobs.
When the "tight loop code" in your Main sub calls DoEvents it causes your
app to go away and perform any outstanding events, and the code in your sub
(the tight loop code in Main) will not move onto the next line of code in
that Sub until all events have been actioned. However, one of the events it
has "gone away to look after" is the event that occurred when the user
clicked the button that caused the MsgBox or the CommonDialog to display,
and since code in that event is stopped (as I said it would be) until the
user dismisses the MsgBox or the Dialog then the "event" which your DoEvents
allowed to happen has not been completed, therefore the next line of code in
your Main sub loop (the line of code following the DoEvents) will not be
actioned until the user dismisses the MsgbBox and allows the event to
complete. In other words, the DoEvents in your tight loop code in Sub Main
(if that's where you've got it) is blocking the rest of that Sub code from
executing until the events have been fully dealt with. That's where your
problem lies, and if you look at the response I posted about twenty minutes
ago you'll see how it can easily be done without your "tight code in a loop"
method. The method I've suggested in my previous response should solve your
problem.
Mike
I see now, its being stopped in DoEvents. Thanks.
I am not sure I can get the data form the two forms from a timer. I
will explore it. It's the fact that the data is for two form objects
that makes it hard.
And, if I set up a timer to run at 100 hertz, will it truely keep up
with the 100 hertz data input? It will come in a halt till it gets
the two values (that are available at 100 hertz). Will it fire again
on a fixed 100 hertz schedule, or will it fire again in 1/100th of a
second?
.
- Follow-Ups:
- Re: do pop up boxes stop all events?
- From: Mike Williams
- Re: do pop up boxes stop all events?
- From: tadamsmar@xxxxxxxxx
- Re: do pop up boxes stop all events?
- References:
- VB5: do pop up boxes stop all events?
- From: tadamsmar@xxxxxxxxx
- Re: do pop up boxes stop all events?
- From: Mike Williams
- Re: do pop up boxes stop all events?
- From: tadamsmar@xxxxxxxxx
- Re: do pop up boxes stop all events?
- From: Mike Williams
- Re: do pop up boxes stop all events?
- From: tadamsmar@xxxxxxxxx
- Re: do pop up boxes stop all events?
- From: Mike Williams
- VB5: do pop up boxes stop all events?
- Prev by Date: Re: converting single to integer
- Next by Date: OWA Exp messages with VSB Script?
- Previous by thread: Re: do pop up boxes stop all events?
- Next by thread: Re: do pop up boxes stop all events?
- Index(es):