appletonrd Posted January 6, 2006 Posted January 6, 2006 Hi ppl I have created an app that does quite a bit of processing. My trouble is that when I press the process button, the window will often go blank (especially if you change to another window, and get then back to this app), and the objects don't get refreshed. I tried using this.Refresh() which they say "forces the control to invalidate its client area and immediately redraw itself and any child controls", but it didn't work all that well. At least not as I expected... Is there a simple way to force the window to refresh from time to time, say every x cycles in the main loop? thanks Ricardo Quote
Administrators PlausiblyDamp Posted January 6, 2006 Administrators Posted January 6, 2006 Calling Application.DoEvents should fix the problem. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Leaders snarfblam Posted January 6, 2006 Leaders Posted January 6, 2006 Another possibility would be to do processing on another thread so that the GUI thread doesn't get tied up (search MSDN for info about the Thread class). Quote [sIGPIC]e[/sIGPIC]
Nate Bross Posted January 9, 2006 Posted January 9, 2006 I know this is a bit late, but here's a pretty good example of how to execute a long loop in a different thread. Website Link This will prevent the GUI from freezing up. Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.