public void ThreadJob()
{
for (int i = 0; i < 10; i++)
{
MessageBox.Show(i.ToString());
Thread.Sleep(1000);
}
}
public void ThreadJob1()
{
for (int i = 0; i < 10; i++)
{
MessageBox.Show(i.ToString());
Thread.Sleep(2000);
}
}
private void button2_Click(object sender, EventArgs e)
{
ThreadStart job = new ThreadStart(ThreadJob);
ThreadStart job1 = new ThreadStart(ThreadJob1);
Thread thread = new Thread(job);
Thread thread1 = new Thread(job1);
thread.Start();
thread1.Start();
}
Friday, March 12, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment