Results 1 to 6 of 6

Thread: For Loop Randomly Freezes

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    116

    For Loop Randomly Freezes

    VB Code:
    1. For i = 0 To 9999
    2.    
    3.     strHTML =    'get the source.  i know it gets the source correctly even when it freezes
    4.  
    5.     If InStrB(1, strHTML, "this") <> 0 Then
    6.         x = x + 1
    7.         Label2.Caption = x
    8.     ElseIf InStrB(1, strHTML, "or this") <> 0 Then
    9.         x = x + 1
    10.         Label2.Caption = x
    11.     ElseIf InStrB(1, strHTML, "thisthis") <> 0 Then
    12.         x = x + 1
    13.         Label2.Caption = x
    14.     Else
    15.         add_log strHTML
    16.         lstlog.AddItem Time & " Found it"
    17.     End If
    18.     DoEvents
    19.     Sleep 10
    20.     Pause (1)
    21. Next i

    I'm not sure why it's freezing. It's frozen anywhere from the 2nd time to the 38th. Also if you could tell me why it uses 100% of the cpu even with a pause adn DoEvents that would be great. Thanks for any help
    Last edited by cx323; Apr 28th, 2006 at 09:08 PM.

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