My WinForms application has a tab with a System.Windows.Forms.WebBrowser
control. There are several controls that set the WebBrowser's .Url
property, and when the form repaints it calls the WebBrowser's .Refresh(WebBrowserRefreshOption.Completely)
method.
Occasionally, however, the form gets repainted and the WebBrowser content doesn't change. I break on the .Refresh( )
, and the .Url
is the previous Url. What's going on?
According to MSDN:
If you set the value of this property and then immediately retrieve it again, the value retrieved may be different than the value set if the WebBrowser control has not had time to load the new document.
Well isn't that special? Why doesn't .Refresh( )
wait until the control has "had time to load the new document" before it redraws? Is there any way to force this to happen?