Introduction:
A thread (is a lightweight process) is a single sequential flow of control within a program. Threads can be used to isolate tasks during a single process. In this article I'm going to write a small program which will displaying a wait message during a long process.
Start a new project, and under the click button event, start the Threads. By clicking on the button it will start two threads, one to start the application process and another a wait message window. Here is the C# code.
private void button1_Click(object sender, System.EventArgs e)
{
Thread t1 = new Thread(new ThreadStart(executeTheProcess));
Thread t2 = new Thread(new ThreadStart(showWaitMessage));
t1.Start();
t2.Start();
}
private void executeTheProcess()
{
........
// Process function
}
private void showWaitMessage()
{
........
// wait message function
}
Output:

Posted Online: http://www.csharphelp.com/archives2/archive332.html