views:

119

answers:

0

I've created an ID add-on that has a button. When I click the button I get an error that says, "System.Runtime.InteropServices.COMException (0x800700AA): The requested resource is in use. (Execption from HRESULT: 0x800700AA) at Interop.SHDocVw.IWebBrowser2.Navigate . . ."

My code looks like this:

    Imports IE = Interop.SHDocVw

    Public ReadOnly Property MyIE() As IE.InternetExplorer
        Get
            Return CType(Me.IEObj, IE.InternetExplorer)
        End Get
    End Property

Private Sub Button1_OnClick(ByVal sender As System.Object, ByVal htmlDoc As System.Object) Handles Button1.OnClick
    'This subroutine navigates the browser to http://www.xyz.com/
    Try
        'This code works, but it creates a new window
        'Dim MyBrowser As SHDocVw.InternetExplorer
        'MyBrowser = New SHDocVw.InternetExplorer
        'MyBrowser.Navigate("http://www.xyz.com")
        'MyBrowser.Visible = True

        MyIE.Navigate("http://www.xyz.com")
        MyIE.Visible = True
    Catch ex As Exception
        MessageBox.Show("During navigate, caught exception " + ex.ToString())
    End Try
End Sub

I've been able to get the button to open a new browser window and navigate to the page, but I want to be able to navigate in the current tab of the same IE window.