Question Simple Form - "WebBrowser" - "Internet Connection"

Daalpadu

Member
Joined
Oct 12, 2013
Messages
5
Location
Norway
Programming Experience
Beginner
Good Day!
First of all, GREAT forum!

I have been "programming" for the last year, I am still Newbie!! =)
In this form I wanted to put a WebBrowser but I wanted this:
*If no internet connection display an image/text or something instead of the Internet Explorer "Navigation to the webpage was cancelled".
*Disable Options (right click).

I am using Visual Studio 2012 Ultimate.
Can someone help me with this?
 
Simple solution, put this in Navigating event handler for your WebBrowser:
        If e.Url.ToString.StartsWith("res://ieframe.dll/navcancl.htm") Then
            Me.WebBrowser1.DocumentText = "some error occurred"
        End If

For more advanced error handling see this: WebBrowser.CreateSink Method (System.Windows.Forms)
 
Thanks for the response.
But
This is what happends...
Untitled.png
 
This is what happends...
That is what happens when you don't follow directions. What event handler did I say to use?
 
I said use Navigating event, you use DocumentCompleted event and that is the wrong event.
 
What if I want to show a picture or htm file instead of the text?
DocumentText property said:
Gets or sets the HTML contents of the page displayed in the WebBrowser control.
Either that or Navigate to a url that contains the html you want to display.
 
Hello John.

Thanks for helping me, but now I have another question regarding this as well.

If I want it to display a htm file that is found in the same folder, how do I do that?

Untitled.png

Best Regards,
Daniel
 
Use the Navigate method to navigate to the full path of the file.
 
Back
Top