Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

I have a progress bar on my start up form which I'd like to increase from its minimum to its maximum value after form loads!

Here's what I try to do on Form_Load event:

...
Me.Show()
Application.DoEvents()
For MyLoop As Integer = 1 To 100
   MainForm.EditorProgressBarItem.Value = MyLoop
   Thread.Sleep(10)
Next

But it will prevent my form controls from being activated until progress bar fully loads!

 

Is there any better way? I heard I should not use Thread.Sleep ?! :huh:

  • Leaders
Posted
The ideal method would probably be to use a background worker for a multi-threaded approach. At the very least, throw an Application.DoEvents() in your loop. And, yes, throwing Thread.Sleep in a loop to time it is generally frowned upon.
[sIGPIC]e[/sIGPIC]

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...