WebBrowser 2.0 control and frames.

DC123

New member
Joined
Jun 13, 2007
Messages
3
Programming Experience
Beginner
Hi,

When I try to access the source code or a control contained in a frame from the WebBrowser 2.0 (VB 2005 Express) control I get the following error:

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Can anyone tell me why I am getting this error or maybe point me in the direction of some reference material on the WebBrowser 2.0 control. I only seem to get info. on the WebBrowser Com (VB6?) control. Thanks.
 
Does this give you an idea?
VB.NET:
    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) _
    Handles WebBrowser1.DocumentCompleted
        If WebBrowser1.Document.Window.Frames.Count > 0 Then
            MsgBox(WebBrowser1.Document.Window.Frames(0).Document.Body.OuterHtml)
        End If
    End Sub
 
Does this give you an idea?
VB.NET:
    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) _
    Handles WebBrowser1.DocumentCompleted
        If WebBrowser1.Document.Window.Frames.Count > 0 Then
            MsgBox(WebBrowser1.Document.Window.Frames(0).Document.Body.OuterHtml)
        End If
    End Sub

You are telling me to check to see if there are some frames before I get the source. I know the frame I want exists but when I try to get the source I get the above error, even with your code.
 
Back
Top