Form losing focus stops counter

woklet

Member
Joined
Mar 4, 2005
Messages
15
Programming Experience
5-10
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer = 1
For i = 1 To 100000
Me.Label1.Text = Str(i) & " of 100000"
Me.Refresh()
Next
End Sub

When I click my Button1 and then click on another window, say Windows Explorer or Outlook, etc., my VB.NET form obviously loses focus. When I come back to it it doesn't refresh until the loop is completed.

Is there anyway to either keep the VB.NET form modal; not just within my VB.NET app but throughout all of the windows that are up on my PC?

Or is there a way to keep it running in the background or refresh it upon activating? I've tried the activated event, but it still waits for the for loop to finish.

Any thoughts? Thanks
Ben
 
Hey, thanks for the quick response.

After studying that post/code, it looks as though the application will "pause" if it loses focus. Is that true? Is there a way to keep it running?

Thoughts...
Ben
 
Back
Top