Results 1 to 2 of 2

Thread: webbrowser error messages

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 1999
    Location
    Texas, US
    Posts
    45

    Post

    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.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    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...
    Code:
    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..
    Code:
    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
    [email protected]
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width