Difference between .Update and .Refresh

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to get a form and all its controls to be visually redrawn before the next line of code begins execution. Which should I call before that particulare line of code executes, .Update or .Refresh?
 
Update forces a control to receive a WM_PAINT message for the currently
invalidated area. Refresh does a full invalidation of the control followed
an update. Whether this helps or not I can't say - essentially you'll have
to iterate all the controls on the form and call their update method but if
the control's handle has not been created, this won't help.

michael said:
I need to get a form and all its controls to be visually redrawn before
the next line of code begins execution. Which should I call before that
particulare line of code executes, .Update or .Refresh?
 
Hi Michael,
I agree with the answer from Andrew.

In addition, Refresh() calls Invalidate(1) to force the control to invalidate its client area and then call Update() to redraw itself and child controls immediately.

Update() updates the client area by sending a WM_PAINT message, if the update region is not empty. This method sends a WM_PAINT message directly,
bypassing the application queue. If the update region is empty, WM_PAINT is not sent.

Best regards,
Rhett Gong [MSFT]
Microsoft Online Partner Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 
Thanks. I'll give the .Refresh a try. I'm looking for immediate repainting for when a dialog closes to avoid the odd rectangle on the underlying form

Michael
 
Back
Top