Possible Threading situation

  • Thread starter Thread starter Mantorok
  • Start date Start date
M

Mantorok

Hi all

I have 2 methods in a class, ShowForm() and FormRespond(). The situation is
that ShowForm() will fire up a form and display it, however, when the form
is displayed it can and will at somepoint call the FormRespond() method in
the class, once the FormRespond() method is called I want ShowForm() to
continue and return the reponse from the form.

However, the problem arises because I don't want the form modal, I don't
want to have to close the form to recieve its response, I need it to respond
itself.

In a nutshell ShowForm() needs to do:


a.. Display the Form
a.. Wait around until the form has called respond
a.. FormRespond is called, then (somehow) informs ShowForm that it can
continue
a.. ShowForm then continues and returns the value

Is this possible? The reason for using Show() is that the form doesn't need
to close once it has responded, so I want it to still display.

Hope that makes sense
Thanks
Kev
 
Hi Kev
one way to solve your issue is to make the call to FormRespond an
"Asynchronous call" with the Completion Technique to be callback " a wait
on handle might also work" . the you will write the the rest of the code of
ShowForm inside the method that is send wit the callback to the begin
invoke method . you can read more about how to do that on this link

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconAsynchronousProgramming.asp
hope that would help
 
Mantorok,

There isn't enough information here to give a definitive answer to your
questions. I don't want to cover all of the options, because the right
answer depends on having more detail. I'd have to give a list of options
depending on what you really want to occur, the environment of the 'class',
etc.

Chris A.R.
 
Back
Top