Results 1 to 5 of 5

Thread: Do and Loop commands

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879

    Angry

    Check out this code. It freezes the program if the browser isn't ready!

    Code:
        Do
            If WebBrowser.ReadyState = READYSTATE_COMPLETE Then
                'Code goes here
            End If
        Loop Until WebBrowser.ReadyState = READYSTATE_COMPLETE
    Try it on your Pc and tell me what happens
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    Change it just slightly.
    Code:
    Do
        DoEvents
        ' Code goes here
    Loop Until WebBrowser.ReadyState = READYSTATE_COMPLETE

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879
    i think there's an error in my code. Because I want my form to do something when the browser is ready and I want it to do that thing only once. so How would I do that?
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  4. #4
    Guest
    Add this to a timer loop:

    Code:
    Private Sub Timer1_Timer()
      If Browser.ReadyState = READYSTATE_COMPLETE Then
        Timer1.Enabled = False
        'Code Here
      End If
    End Sub

  5. #5
    Guest
    Try this:

    Code:
    Do Until WebBrowser.ReadyState = READYSTATE_COMPLETE
        DoEvents
        ' Code goes here
    Loop

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