G
Guest
Hi
I have an application that calls a method that takes a considerable amount
of time. In this method I show and hide forms from an object declared in the
same class using 'ShowForm' and 'HideForm' methods I have written in the
class. I am trying to add a 'Stop' button to allow the user to terminate the
method if there is a problem.
The solution I have been using at the moment is to start the method in a new
thread, then terminate the thread when the button is pressed which stops
execution immediately. The problem is that terminating the thread seems to
destroy the forms. Any call I make to the form after the thread has been
terminated gives the exception 'Error creating window handle'.
I am wondering if there is a better way to immediately stop a method from
executing (has to be instant).
Thanks in advance.
I have an application that calls a method that takes a considerable amount
of time. In this method I show and hide forms from an object declared in the
same class using 'ShowForm' and 'HideForm' methods I have written in the
class. I am trying to add a 'Stop' button to allow the user to terminate the
method if there is a problem.
The solution I have been using at the moment is to start the method in a new
thread, then terminate the thread when the button is pressed which stops
execution immediately. The problem is that terminating the thread seems to
destroy the forms. Any call I make to the form after the thread has been
terminated gives the exception 'Error creating window handle'.
I am wondering if there is a better way to immediately stop a method from
executing (has to be instant).
Thanks in advance.