Mario

Mario

  • NA
  • 6
  • 0

Opening a form from a method and making that method wait until the form is closed?

Mar 22 2006 11:31 AM
Hi all,

I already posted this question in the Windows Forms forum, but the only way I can think this can possibly be done is with threads.  Here is my question:

I am trying to figure out a way to call a method from a COM object (which I have done) and have that method pop up a form.  I need to 'pause' the method until the user is done with the form and clicks a button.  The method can then continue on and return data that may have been modified from the form.

My initial idea was to spawn a thread from my main method and in that second spawned thread create and open the form, while suspending the main method/thread.  Unfortunately, this doesn't seem to work.  When the second thread shows the form, it isn't painted and is unusable until the thread exits.  When the main method exits, the form disappears.

Does anyone have any ideas on how this is possible?  Thanks in advance,

Answers (1)