int myMain(System::Windows::Forms::ListBox^ lstStatus)
{ do
{
// the code that is executed
}while (terminate == false);
}
when i press the start it places terminate on false and executes my code.
when i press stop it places terminate on true but still executes my code,
how do i get out of the thread by using the stop button
I don't know C++/CLI language, but the idea is this:
In your worker thread procedure (I think Form1::doTheWork) check the bool variable terminate every time you can and return when becomes false. There are better ways to do it, but keep it that way for now.
The variable must be accesible from both threads, in your code I don't think it is.