Search Forum
(57415 Postings)
Search Site/Articles

Archived Articles
712 Articles

C# Books
C# Consultants
What Is C#?
Download Compiler
Code Archive
Archived Articles
Advertise
Contribute
C# Jobs
Beginners Tutorial
C# Contractors
C# Consulting
Links
C# Manual
Contact Us
Legal

GoDiagram for .NET from Northwoods Software www.nwoods.com


              
Printable Version

Displaying a "Wait" message during a long process with C# Threading
By Waheed Khan

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.

During a long process displaying a wait message can be done with Threading.

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.

 

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:

Download the source code - 9 kb