Visual Basic, cannot Refresh an IE object (SHDocVw.InternetExplorer), throws exception
Posted on 2014-08-27
I have an application that first navigates to a website by invoking a separate IE browser window via calls to SHDocVw.InternetExplorer (project requirement is that the browser cannot be in the app). When oIE.Navigate is called the IE browser correctly goes to the requested page. A loop is called to check whether the page is fully loaded (certain HTML text) and if after 10 seconds it will try to refresh the page. However calls to oIE.Refresh generate an exception (Error HRESULT E_FAIL has been returned from a call to a COM component. StackTrace: at SHDocVw.IWebBrowser2.Refresh() ) I have already implemented a loop to recheck the page's html code every 1/2 sec to wait for the page to update, but it continues to show the old page info.
Is there a way to tell the SHDocVw.InternetExplorer to get the new HTML from the IE browser window, or at least call Refresh?