On Tue, 6 Dec 2005 05:09:02 -0800, "mark"
<ma**@discussions.microsoft.com> wrote:
I have an application with several methods, many of which perform matrix
computations. Occasionally the methods will take too long to complete and the
user may want to abort and do something else.
I envision a "abort" button which raises an event but I am uncertain how to
implement stopping whatever procedure happens to be active. Is there some
global "halt whatever happens to be executing" technique?
Looks like a perfect candidate for threading. Start a thread passing
it the address to your matrix calculation subroutine, and if the user
hits the Abort button, you kill the thread.
I'm no expert on threading so better advice is likely to follow, but
one of many cautions is that only the UI thread is allowed to touch
the controls on a form. Not that other threads can't do so but don't
do it because it will fail on some random basis that you will never be
able to debug.