Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
When you have a loop in a sub, your application is not responsive when its executing unless you use multithreading.

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

  • *Experts*
Posted

If he is using Application.DoEvents it will.

 

You can do this:

Private keeplooping As Boolean = True

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
 Do While keeplooping
   Application.DoEvents()
   'other stuff
 Loop
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
 keeplooping = False
End If

That'll turn off the boolean variable which will cause the loop to stop after its next iteration (it will not break out of the middle of the loop).

Posted
I've seen it used just to refresh breefly enough to repaint the form and loose it again to process.

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...