Results 1 to 4 of 4

Thread: Loop help needed

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Posts
    377

    Question Loop help needed

    can anyone help me with this coding? i'm trying to get Loop to check if the browser is still busy and if its been busy for
    more than 3 secs to stop

    VB Code:
    1. Dim gStart As Long
    2. gStart = Timer
    3.  
    4.   Do
    5.   DoEvents
    6.   Loop Until If Not WebBrowser1.Busy = True Then
    7.   End If
    8.   ElseIf InStr(1, WebBrowser1.LocationURL, "user?/nemx") <> 0 And Timer - gStart > 3 And
    9.   Not WebBrowser1.Busy = False Then
    10.   WebBrowser1.Stop
    11.   End If

  2. #2
    Hyperactive Member wordracr's Avatar
    Join Date
    Aug 2001
    Posts
    281
    Well, to check for the browser is still loading something, this will work for most cases:

    Code:
        Do
    
            DoEvents
            
        Loop Until wb.ReadyState = READYSTATE_COMPLETE
    any other questions?

  3. #3
    Hyperactive Member Ed Lampman's Avatar
    Join Date
    Mar 2001
    Posts
    273
    I don't think you can use an 'IF' statement in your Do-Loop condition.

    Your Do-Loop should be either:

    Do

    Loop Until WebBrowser1.Busy = True

    OR

    Loop Until WebBrowser1.Busy = False

    The IF Then statement should be inside the Do-Loop somewhere, if I follow your logic correctly.

  4. #4
    Hyperactive Member wordracr's Avatar
    Join Date
    Aug 2001
    Posts
    281
    I didn't realize what you wanted to do. This code should suit you better =0



    Code:
    timer1.interval = 3000
    
    timer1.enable = true
        Do
    
            DoEvents
    
            If bolTimesUp Then Exit Do
    
        Loop Until wb.ReadyState = READYSTATE_COMPLETE
    
    
    
    timer1_timer()
            timer1.enabled = false
            bolTimesUp = True
    End Sub

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