Re: Simple WinForm ( Not Responding ) Refesh Issue C# 2.0
- From: "Morten Wennevik [C# MVP]" <MortenWennevik@xxxxxxxxxxx>
- Date: Thu, 13 Sep 2007 21:36:55 +0200
On Thu, 13 Sep 2007 21:06:55 +0200, OZI <sql_agentman@xxxxxxxxxxx> wrote:
for (int x = 0; x < progressBar1.Maximum ; x++)
{
progressBar1.Increment(1);
System.Threading.Thread.Sleep(1000);
this.Refresh();
}
Telling the window to refresh itself isn't helping much since you don't give it any time to handle user interaction. If you add Application.DoEvents() after Refresh() (or instead of as you don't need to refresh to update the progress bar) you should see a noticeable difference. Alternately go the BackgroundWorker way (see the code sample in my other reply)..
--
Happy coding!
Morten Wennevik [C# MVP]
.
- Follow-Ups:
- References:
- Simple WinForm ( Not Responding ) Refesh Issue C# 2.0
- From: OZI
- Re: Simple WinForm ( Not Responding ) Refesh Issue C# 2.0
- From: Chris Shepherd
- Re: Simple WinForm ( Not Responding ) Refesh Issue C# 2.0
- From: OZI
- Re: Simple WinForm ( Not Responding ) Refesh Issue C# 2.0
- From: Peter Duniho
- Re: Simple WinForm ( Not Responding ) Refesh Issue C# 2.0
- From: OZI
- Simple WinForm ( Not Responding ) Refesh Issue C# 2.0
- Prev by Date: Re: Nullable Dates
- Next by Date: Re: static class libraries?
- Previous by thread: Re: Simple WinForm ( Not Responding ) Refesh Issue C# 2.0
- Next by thread: Re: Simple WinForm ( Not Responding ) Refesh Issue C# 2.0
- Index(es):
Relevant Pages |