Results 1 to 11 of 11

Thread: wait for website to finished loading webbrowser control

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Posts
    305

    wait for website to finished loading webbrowser control

    Hey,well im using webbrowser control and when it submits the submit button it takes while to load then will say "loaded" on this site,the problem is it has code after and it loads b4 the site is loaded i tried using sleep but still buggy

    WebBrowser1.Document.All.submit.Click

    Sleep 9000
    WebBrowser1.GoBack

    thats what im using but it "freezes" well sleeps so it cant finish loading the site then goes bak,so basicaly i want the site to finish loading after clicking submit then go bak to the page thanks
    Last edited by Mr_Zer0; Apr 7th, 2006 at 11:48 AM.

  2. #2
    Member
    Join Date
    Sep 2005
    Location
    Netherlands, The
    Posts
    41

    Re: how wait for site to load

    try the WebBrowser_DocumentComplete event also check if the document object is nothing if so then exit the event

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Posts
    305

    Re: how wait for site to load

    you got example thanks

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Posts
    305

    Re: how wait for site to load

    any one please?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Posts
    305

    Re: wait for website to finished loading webbrowser control

    i need this bad any help

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

    Re: wait for website to finished loading webbrowser control

    VB Code:
    1. Private Sub WB1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    2.        If (pDisp Is WB1.Application) Then
    3.                   '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"

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Posts
    305

    Re: wait for website to finished loading webbrowser control

    hmm i dont understand how to use this ?

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

    Re: wait for website to finished loading webbrowser control

    thats the webborwser_documentcomplete event...

    the pdisp is webbrowser... is to check to make sure the ENTIRE page is loaded...

    so you code goes inside the IF statement..
    chec the URL to see where u are

    IF URL = "whatever.." then
    Click submit...
    Else
    Go back
    end if

    kinda like that
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Posts
    305

    Re: wait for website to finished loading webbrowser control

    Private Sub WB1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    If (pDisp Is WB1.Application) Then
    WebBrowser1.Navigate "www.google.com"
    End If
    End Sub

    Private Sub Form_Load()
    If URL = "www.google.com" Then
    MsgBox "hi"
    Else
    End If
    End Sub


    maybe somthing like this?but doesnt load i respect you for tryin to help

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2003
    Posts
    305

    Re: wait for website to finished loading webbrowser control

    hey i got it to work but this way is buggy for me any over ways?thanks

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

    Re: wait for website to finished loading webbrowser control

    like this

    VB Code:
    1. Private Sub Form_Load()
    2.     WebBrowser1.Navigate "http://www.google.com"
    3.    
    4. End Sub
    5.  
    6. Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    7.     Debug.Print URL
    8.     If (pDisp Is WebBrowser1.Application) Then
    9.         If URL = "http://www.google.com/" Then
    10.             WebBrowser1.Document.All.q.Value = "TEST SEARCH"
    11.             WebBrowser1.Document.All.btnG.Click
    12.         Else
    13.             MsgBox "Search Results"
    14.         End If
    15.     End If
    16. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

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