woklet Posted June 3, 2005 Posted June 3, 2005 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 Quote
Administrators PlausiblyDamp Posted June 3, 2005 Administrators Posted June 3, 2005 Have you tried putting a call to Application.DoEvents inside the loop? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.