Hi all. I want to stop a thread in my app by click on button3.
What should I do?
public void Button1_Click(object sender, EventArgs e)
{
Cache["t"] = 0;
Thread thr = new Thread(new ThreadStart(func));
Cache["thr"] = thr;
thr.Name = "thr";
thr.Start();
}
public void func()
{
System.Threading.Timer timer = new System.Threading.Timer(new TimerCallback(timerTick), null, 0, 1000);
Cache["timer"] = timer;
}
private void timerTick(object a)
{
int b = Int32.Parse(Cache["t"].ToString());
b++;
Cache["t"] = b;
SqlConnection con = new SqlConnection();
con.ConnectionString = "server=pc5;database=test;integrated security=true";
SqlCommand com = new SqlCo ...
Go to the complete details ...