Click here to Skip to main content
15,914,071 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Application.DoEvents(); statement shows the Progress circle immediately but it does not spin while long task is running.
Please help, I can't figure out what I am doing wrong.
My sample code:
C#
private void btnFindFileAndLoad_Click(object sender, EventArgs e)
{
    this.progressCircle1.Visible = true;
    this.progressCircle1.Rotate = true;
    Application.DoEvents();  //process message queue
    LoadMyFile(str_FileDirectory_and_FileName);  //runs for 20sec
	
    this.progressCircle1.Visible = false;
    this.progressCircle1.Rotate = false;
}
Posted
Updated 12-Oct-10 11:15am
v2

1 solution

It's because it's on the same thread. You need to run the progress circle on a background thread or load the file on a background thread and turn off the progress circle when the background thread completes.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900