Results 1 to 40 of 48

Thread: using .getElementsByName

Threaded View

  1. #33
    Fanatic Member
    Join Date
    Aug 2010
    Posts
    624

    Re: using .getElementsByName

    Well if thats in the main thread, you will hang your entire app permanently, as you can't sleep the thread and load the webpage asynchronously from the same thread. You'd need to create a new thread for that wait sub.

    vb Code:
    1. Dim nT As New Threading.Thread(AddressOf wait)
    2.         nT.Start()
    3.  
    4.  
    5.     Private Sub wait()
    6.         While WebBrowser1.ReadyState < 4
    7.             Threading.Thread.Sleep(100)
    8.         End While
    9.         '//next call after WebBrowser is finished loading
    10.     End Sub

    As for only doing it once, you need to narrow down when the procedure is run on the documentcompleted event. At the moment, whenever the document finishes loading it will run. Either slip in a global boolean that you set by default to true, on the documentcompleted event check if this is true or not, and if so run it and then set the value to false to prevent further execution.
    Last edited by J-Deezy; Oct 6th, 2010 at 09:07 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