controling a never ending loop code

R

red6000

Hi,

I have code that I want to put into a loop. In essence, this loop could be
never ending (and that is what I want to actually happen).

However in reallity I want to be able to stop and start the loop at will.

So really i think I need a non-modal form with 2 buttons (stop and start).

Now doing the start button is easy, but what code would I need in the stop
button to stop the 'start' code from running?

Hope that makes sense and thanks for any help/pointers.

Steve.
 
J

Julian

As long as you include DoEvents in your main loop you will be OK - doEvents
will allow the system to see the other button click and - presumably through
some global variable - you can pause, rename the buttons, resume from where
you left off, whatever you want, through the other button's event code.

Julian
 
R

red6000

fantastic!!

That works a treat.

Thanks

Julian said:
As long as you include DoEvents in your main loop you will be OK -
doEvents
will allow the system to see the other button click and - presumably
through
some global variable - you can pause, rename the buttons, resume from
where
you left off, whatever you want, through the other button's event code.

Julian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top