There is one function which is listening.
I want it to be run continuously and rest of the program should also be fully operatable.
How can i do it?
Printable View
There is one function which is listening.
I want it to be run continuously and rest of the program should also be fully operatable.
How can i do it?
you can make it call itself and run it on a seperate thread.
this code keeps checking if a checkbox is checked and terminates the thread if it isn't.
Code:private void button1_Click(object sender, System.EventArgs e)
{
System.Diagnostics.Debug.WriteLine("startthread");
Thread t = new Thread(new ThreadStart(threader));
t.Start();
}
private void threader()
{
Thread.Sleep(100);
if (this.checkBox1.Checked)
{
threader();
}
else
{
System.Diagnostics.Debug.WriteLine("stop");
}
}