C# - How can i open a second winform asynchronously but still behave as a child to the parent form?

Posted by Gary Willoughby on Stack Overflow See other posts from Stack Overflow or by Gary Willoughby
Published on 2010-03-12T20:42:56Z Indexed on 2010/03/12 20:47 UTC
Read the original article Hit count: 327

Filed under:
|

I am creating an application and i would like to implement a progress window that appears when a lengthy process is taking place.

I've created a standard windows form project to which i've created my app using the default form. I've also created a new form to use as a progress window.

The problem arises when i open the progress window (in a function) using:

ProgressWindow.ShowDialog();

When this command is encountered, the focus is on the progress window and i assume it's now the window who's mainloop is being processed for events. The downside is it blocks the execution of my lengthy operation in the main form.

If i open the progress window using:

ProgressWindow.Show();

Then the window opens correctly and now doesn't block the execution of the main form but it doesn't act as a child (modal) window should, i.e. allows the main form to be selected, is not centered on the parent, etc..

Any ideas how i can open a new window but continue processing in the main form?

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms