Return of Control from a Child form

S

Sendhil

hi,
I have an application with a MainForm(Parent) and SubForm(Child).
on click of a button the Child form is created. Iam not sure where in
the MainForm,the control is returned when i close the child form.

I need to know this to populate some values in a list box in the
Main form, which were got from the Child form. Is there any other way
to access a control in the Main form from the Child form.

Thanks
sendhil
 
S

Schwang

i can answer with respect to MFC. when u create a dialog(or form) from other
dialog(or form), parent is set.. so from the child dialog u can always do
PostMessage to its parent with the lParam u want to...
 
C

Chris Dunaway

on click of a button the Child form is created. Iam not sure where in
the MainForm,the control is returned when i close the child form.

It partially depends on how the Child form is displayed. If you display
the child form using the ShowDialog method, then when the child is closed,
control is returned to the statement immediately following the ShowDialog.

If you use the Show method, then the parent form continues without waiting
for the Child form to close. In this case, the best method would be to
pass a reference to the parent into the child so that the child could
access properties of the parent.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top