Jimbo99999
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Never experienced that. Call DoEvents before setting the cursor.
ASKER
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
Thanks,
jimbo99999
Yes.
ASKER
Excellent...no white UI tha tlast time.
Thanks,
jimbo99999
Thanks,
jimbo99999
ASKER
Another good one to put in the toolbox as I continue the learning process.
Thanks again,
jimbo99999
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...
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...
ASKER
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
jimbo99999
ASKER