Click to See Complete Forum and Search --> : webbrowser error messages
Charlezz
Sep 24th, 1999, 04:49 AM
I have a webbrowser on a form and I have the buttons "Back", "Forward", and "Stop". when I click on them and there is no page loaded or, the page loaded is the first page, then I get a nasty error message. I would like to eityher make my own error messge, or bypass the whole thing by ignoring the command if nothibg is loade.
Aaron Young
Sep 24th, 1999, 01:53 PM
Just use the On Error Resume Next Statement to bypass any error that may occur, or if you want to trap it and generate your own, redirect it to your Error Handler, eg.
On Error Resume Next Example...
Private Sub cmdBack_Click()
On Error Resume Next
WebBrowser1.GoBack
End Sub
Private Sub cmdForward_Click()
On Error Resume Next
WebBrowser1.GoForward
End Sub
Private Sub cmdHome_Click()
WebBrowser1.GoHome
End Sub
On Error Goto .. Example..
Private Sub cmdBack_Click()
On Error Goto Back_Err
WebBrowser1.GoBack
Back_Err:
If Err Then Msgbox "My Own Back Error Message"
End Sub
Private Sub cmdForward_Click()
On Error Goto Forward_Err
WebBrowser1.GoForward
Forward_Err:
If Err Then Msgbox "My Own Forward Error Message"
End Sub
Private Sub cmdHome_Click()
WebBrowser1.GoHome
End Sub
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.