With referencve to your originalthread222-1798177, incorrectly posted in the VB Classic forum
The code is somewhat ugly and cumbersome, but that's neither here nor there - your primary issue us that you have a non-yielding loop (LengthyTask),which, once entered, blocks the UI thread and does not allow any Windows messages to be processed - such a clicking a button. Simplest way to deal with this is to add an
[tt]Application.DoEvents[/tt]
just before the End While, like this:
Code:
[blue] Public Sub LengthyTask()
While True
If flag Then
Exit While
End If
[COLOR=#F57900]Application.DoEvents()[/color]
End While
MsgBox("TextBox1.Text = " & TextBox1.Text)
End Sub[/blue]
Note that your code may well still do some slightly odd things, particularly since this fix will now allow reentrancy ...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.