CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2001
    Posts
    65

    WebBrowser DocumentComplete & Frames Problem

    I have the following trouble with the documentcomplete event.
    --------------------
    Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As
    Variant)
    Text3.Text = _ WebBrowser1.Document.frames(3).Document.body.innertext
    End Sub
    ----------------

    The problem is that the Documentcomplete sub routine fires before the page
    shows in the webbrowser window. I have tried with for next loops and the
    timer control to force delays several praces in the code, but that seems to
    halt the web browser control.

    If I add a message box and wait till the page shows, it works fine.

    Any help will be highly appreaciated as this problem is driving me mad! :-)

    Best regards

    pokpoki

  2. #2
    Join Date
    Sep 2004
    Posts
    292

    Re: WebBrowser DocumentComplete & Frames Problem

    Have you tried the downloadcomplete instead of documentcomplete?
    Intelligent people talks because they have something to say,
    Fools talk because they have to say something....

  3. #3
    Join Date
    Dec 2002
    Posts
    55

    Re: WebBrowser DocumentComplete & Frames Problem

    This is from the Microsoft website:

    Code:
    Private Sub myIE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    If pDisp Is myIE Then
        DocComplete = True  
    End If
    End Sub
    And then test:

    Code:
    DocComplete = False  '<---- set module level boolean variable
    
    myIe.navigate ("http:\yourpage.com")   '<---- Load Page here
    
    Do Until DocComplete = True
        DoEvents
    Loop
    
    Text3.Text = MyIE.Document.frames(3).Document.body.innertext
    This code ensures that the whole page is loaded.
    Last edited by Relentless; June 13th, 2005 at 08:57 AM.

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

Featured