.NET Form_load priority

Posted by mtranda on Stack Overflow See other posts from Stack Overflow or by mtranda
Published on 2010-05-06T19:25:04Z Indexed on 2010/05/06 19:28 UTC
Read the original article Hit count: 361

Filed under:
|
|
|
|

So, the problem is such as this: I have a method that does stuff and updates a progress bar. If I call the method after the form is fully loaded (i.e.: by assigning it to a button on the form) everything works fine. The problem is that I need the method to start working as soon as the form loads, by itself, so I would place it in the Form_Load method. The problem is that even though I call Application.DoEvents() right before calling that method from within Form_Load, the form doesn't show up until the method has completed everything.

As I said, if I let the form load first and call the method from another UI element for instance, everything works fine.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about winforms