programming an interupt

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How would I program an interupt. If I have two buttons on a form, one starts
a loop and the other stops the loop. What code would I need to add?


private void button1_Click(object sender, System.EventArgs e)
{
int a= 1;
int b= 0;
while (a != 0)
{
b += 1;
}
}

private void button2_Click(object sender, System.EventArgs e)
{
//interrupt code

}
 
=?Utf-8?B?RGF2ZQ==?= said:
How would I program an interupt. If I have two buttons on a form, one
starts a loop and the other stops the loop. What code would I need to
add?

You can use DoEvents and simply set a flag to use cooperative multitasking.
For thread based you'll need to use a mutex or semaphore.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
 
Back
Top