Thread trd;
private void btnRun_Click(object sender, EventArgs e)
{
trd = new Thread(new ThreadStart(this.ThreadTask));
trd.IsBackground = true;
trd.Start();
}
[STAThread]
private void ThreadTask()
{
//Do something here
}
private void btnStop_Click(object sender, EventArgs e)
{
if (trd != null)
{
trd.Abort();
trd = null;
}
}
private void btmExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
Sunday, July 19, 2009
Create a new thread
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment