GUI Update not occuring - C#

forgottensoul

Newcomer
Joined
Nov 16, 2004
Messages
17
I am using C# Express 2005 version and I have the following issue:

I have a progress bar with text showing the user progress of file copies. The progress bar and text update for a while but then "lock up". The copy does continue and goes to completion so the code behind being executed isn't having a problem, just the GUI is giving the end user a huge negative experience.

Is there anyone to get a smoother, non-lock up of the GUI when performing tasks?

I have tried:
- Adding a Sleep
- Performing a Refresh() on the forum
- Performing a Update() on the forum
- Combinations of the above

with no luck or change in this behavior. I also looked for a "DoEvents" like VB has, but I didn't see it in C#. (Are Refresh and Update the equivalent?)

I have thought about placing the copy in a separate thread to see if that would help, but I wanted to ask before heading down what might be a slipper slope for me.

Thank you for your time,
 
Hi,

C# does have a DoEvents - try:
C#:
 Application.DoEvents();

Personally if I am using a routine which may take a while and there is a progress meter, I like to always launch the routine in a seperate thread.

I hope this helps, I'm new to C# myself so my appologies if I'm wrong about DoEvents (I don't have VS installed on this PC)
 
That did the trick!

I also agree with you about the seperate thread, but I knew there had to be something I wasn't missing.

Thanks again!
 
Back
Top