How to stop a Loop?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
In my windows form there are two buttons , <b>Start</b> and <b>Stop</b>. When i press the <b>Start </b>button a loop (While loop or a foreach or any other loop) starts to execute and it will take some time for it to end.

<div align=left>My question is how to stop the loop <u>before </u>it ends by pressing the <b>Stop </b>button?
How can I code the <b>Stop </b>button to stop the Loop?
Another thing that I noticed is that when the loop is operational the buttons are not active till the loop stops.

Please let me know the solution for this.

Thank You.


View the full article
 
Back
Top