Audax321 Posted November 4, 2002 Posted November 4, 2002 I have my program displaying a label (just says Please wait... blah blah blah) while some code is being run (it takes a while). Well, if my form loses focus and then gains focus... it turns all white until the code is done executing. Since this could cause the user to think the application is crashing, is there anyway to prevent this. This happened in VB6 too but wasn't as much of a problem with programs I wrote under that. Thanks... :) Quote
*Experts* Volte Posted November 4, 2002 *Experts* Posted November 4, 2002 Are you in a loop? If you are, you could try a few things. For one, you could put Application.DoEvents() at the end of your loop (right before the 'Loop' part). Another way is to put Me.Refresh() at the end of the loop. If the code is in some place where you don't have the source, I don't know. You could look into threading, but there may be an easier way. Quote
Audax321 Posted November 4, 2002 Author Posted November 4, 2002 Thanks.... the me.refresh() didn't work, but the Application.DoEvents() worked great. I was trying to invoke that as just plain DoEvents earlier... completely forgot how to call that in .net. :) Quote
*Gurus* divil Posted November 4, 2002 *Gurus* Posted November 4, 2002 Ideally, you'd run your intensive code in another thread anyway. DoEvents isn't really necessary. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
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.