Results 1 to 4 of 4

Thread: [RESOLVED] Shouldn't WebBrowser1_DocumentComplete happen only once?

  1. #1

    Thread Starter
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    Resolved [RESOLVED] Shouldn't WebBrowser1_DocumentComplete happen only once?

    Hi, I have a program that displays a popup message when the webbrowser control finishes loading a page. The problem is I get between 3-5 messages as the page loads, like its loading 5 pages.

    I use the procedure for "WebBrowser1_DocumentComplete" so I figured once the entire page is done, this will run but it runs multiple times. Is there anyway to limit this to runs once at the end of the page download? the popup is displaying information it reads from the page and the first 1-2 messages are blank becuase the page hasnt loaded that far yet. any help?
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Shouldn't WebBrowser1_DocumentComplete happen only once?

    no actually it can trigger many times... (for example..For each frame..)

    to check for it to be completely loaded do this:

    VB Code:
    1. Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    2. [B]If (pDisp is Webbrowser1.Application) Then[/B]
    3.  'do code here
    4. End If
    5. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    Re: Shouldn't WebBrowser1_DocumentComplete happen only once?

    Thanks static, you come through again in a pinch
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

  4. #4

    Thread Starter
    Fanatic Member neicedover1982's Avatar
    Join Date
    Jun 2005
    Posts
    566

    Re: [RESOLVED] Shouldn't WebBrowser1_DocumentComplete happen only once?

    A little side question, I am sure you probably can answer it static. Sometimes weather.com gives errors, the runtime ones that ask if you want to debug. Is there anyway to stop these types of errors? Actually all messages? I got the popups stopped using the NewWindow2 sub.

    The reason I ask is that the form is hidden and once and a while this message might popup when the program reloads the webpage to get the newest temperatures.
    Kevin | New England Iced Over | http://www.kevincawleyjr.com

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