Hi
I have a form with a webbrowser control on it - this loads up a pdf file I select from a file dialogue.
What I'd like to be able to do is show the hourglass until the page (pdf) is finished loading in the browser.
I found some code here: https://en.wikibooks.org/wiki/Web_Pr...ual_Basic_.NET which lets me know when the page is loaded (actually the example covers when it's ready to print, but it works the same). I've put this into my code so it looks like this:
Code:Sub Showpage() AddHandler WebBrowser1.DocumentCompleted, New WebBrowserDocumentCompletedEventHandler(AddressOf ReadyToPrint) Me.UseWaitCursor = True WebBrowser1.Navigate(my file name) End Sub Private Sub ReadyToPrint(ByVal sender As Object, ByVal e As WebBrowserDocumentCompletedEventArgs) ' Create a temporary copy of the web browser object. ' At the same time we will assign it a value by coercing the sender argument ' that was passed into this method. Dim webBrowserTmp As WebBrowser = CType(sender, WebBrowser) ' We know that the web page is fully loaded because this method is running. ' Therefore we don’t have to check if the WebBrowser object is still busy. ' It’s time to print… 'webBrowserTmp.Print() Me.UseWaitCursor = False MsgBox("OK page loaded") End Sub
The pointer initially goes to the hourglass, and the msgbox is firing OK to tell me the page is loaded, but the problem is that the hourglass goes back to the default pointer before this stage is reached.
Can anyone suggest how I can get the hourglass to stay until I tell it to go?
Thanks for reading and Merry Christmas!![]()




Reply With Quote
