views:

67

answers:

1

I have a form that calls a custom child form. The child form is basically a popup box that gets some user data.

I want the Parent form to process information returned by the Child form.

The problem is, the Parent form is calling the Child, and isn't waiting for a reply.

Ideally, I'd like to make the Child form return a DialogResult. Functionally, this is clear what's happening (especially since the user has the option to Cancel the child control) and seems like a simple way to force the parent to wait. I haven't figured out how to do this though.

The secondary problem is, the Parent control proceeds beyond the childDialog.Show() event, and tries to process the Child control's info. Which hasn't been altered yet.
Setting up a condition using public values of the Child control, such as childDialog.UserClickedOK, don't do a thing to help, since the default values are still in effect.

What am I overlooking?

Thanks everyone! :)

+2  A: 

You need to show the form modally, using ShowDialog instead of Show. Inside your child form, you set the DialogResult to whatever makes the most sense given the user interaction that happened before.

Jim Brissom
And naturally it was stupidly simple. >_<
Tinkerer_CardTracker