exception handing??

  • Thread starter Thread starter sandy
  • Start date Start date
S

sandy

A subroutine is nested many levels deep in the call
stack, and is looping on a mathematical calculation. If
the user clicks a command button called cmdStop, you want
the loop to stop executing and return control to the top-
level procedure, just after the call to the next lower
level. How would i do that?
thanks all!!
 
sandy said:
A subroutine is nested many levels deep in the call
stack, and is looping on a mathematical calculation. If
the user clicks a command button called cmdStop, you want
the loop to stop executing and return control to the top-
level procedure, just after the call to the next lower
level. How would i do that?
thanks all!!

You can set a boolean flag that is checked in the algorithm. If it is
set, you can execute a 'Return'.
 
Hi Sandy,

You'll need a timer to be checking the boolean flag that Herfried mentioned.

HTH,

Bernie Yaeger
 
Sandy is it this what you are searching for?
In your procedure
\\\\
application.doevents
////
Cor
all!!
 
Hi Sandy,

Are you saying that you want the calculation to abort and jump all the way
out again without going back up through the call stack?** If so, you can
enclose the outermost call in a Try..Catch..End Try block and throw an
Exception in the deepest depths.

Regards,
Fergus

** Or at least without you having to add loads of code to guide it back out.
 
Cor said:
Sandy is it this what you are searching for?
In your procedure
\\\\
application.doevents
////

This will allow user interaction...
 
Herfried
This will allow user interaction...
Message from poster
A subroutine is nested many levels deep in the call
stack, and is looping on a mathematical calculation. If
the user clicks a command button called cmdStop, you want
the loop to stop executing and return control to the top-
level procedure, just after the call to the next lower
level. How would i do that?
thanks all!!

I thought, in every routine applications.doevents
application.doevents
if userhasstopped then exit routine.
I think this stops very fast.
But I can be wrong?
Cor
 
Cor said:
Message from poster
A subroutine is nested many levels deep in the call
stack, and is looping on a mathematical calculation. If
the user clicks a command button called cmdStop, you want
the loop to stop executing and return control to the top-
level procedure, just after the call to the next lower
level. How would i do that?
thanks all!!

I thought, in every routine applications.doevents
application.doevents
if userhasstopped then exit routine.
I think this stops very fast.

If the application should allow user interaction, 'Application.DoEvents'
works. As an alternative you can do the calculation in a separate
thread which checks a flag that tells the algorithm to stop.
 
Back
Top