Link to home
Start Free TrialLog in
Avatar of Jimbo99999
Jimbo99999Flag for United States of America

asked on

VB.Net - Yes/No MessageBox

Good Day Experts!

I have a Yes/No DialogResult MessageBox.  When User answers Yes to process records,  processing starts but then part of the MessageBox can still be seen.  Then eventually where the MessageBox shows the area turns white. Then the area where the MessageBox had turned white goes away and the controls behind it are white.  I do have the cursor changing to the hourglass.

Any ideas what might be going wrong?

Thanks,
jimbo99999
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jimbo99999

ASKER

The Application.DoEvents has cleaned up the situation.  But now my hourglass has gone away before the end of processing message.   Perhaps I need to reset the cursor to the hourglass each time I do Application.DoEvents?
Never experienced that. Call DoEvents before setting the cursor.
CodeCruiser...how do I determine where to periodically put the DoEvents in my code? For some reason this last time I ran the report the UI turned white about 5minutes prior to completion.  I go out to the database to run a S/P 2 times.  Should I do the DoEvent and hourglass setting before and after the S/P calls?

Thanks,
jimbo99999
Excellent...no white UI tha tlast time.

Thanks,
jimbo99999
Another good one to put in the toolbox as I continue the learning process.

Thanks again,
jimbo99999
"the UI turned white about 5 minutes prior to completion"

If your process is going to take 5 minutes then you should DEFINITELY be putting it into a background thread with the BackgroundWorker() control.  

Database operations like that are often blocking calls which means that DoEvents() won't fully fix the problem.  It may allow the form to refresh immediately before the call, but during the database operation the form will be unresponsive and won't repaint.  If the user clicks on the form, or attempts to move it, then it will probably "white out".  This would also occur if they switched to another application and then switched back.

Putting the work in the background thread will keep the form responsive and prevent white outs.  You would NOT need DoEvents() at all then...
I am currently looking for information on your suggestion.  All of this is still new to me so I appreciate the feedback as I continue my learning process.

jimbo99999