How to pass value while closing the child form

C

Chandru

hi
Thanks, some of reply for my query. the actual problem
is, I have two forms Form-A and Form-B. In Form-A i have
two controls TextBox and Button, and in Form-B i have the
same one textBox and Button control.

While i chicking Form-A's Button i create a object for
Form-B and show Form-B as Modaless Form. I entered some
text in Form-B's textBox and press the Form-B's Button to
close(Hide) the form Form-B, while closing i wants to pass
the Form-B's textBox text to Form-A's textBox. Thanks in
advance.

Cheers
Chandru
 
G

GMorris

I'm not 100% sure what you mean, but I think what you probably
need to do is just pass a reference to Form-A when you are
calling Form-B. Personally, I've done this using a Form parameter
in the constructor of the second form (Form-B), then assigning it
to a class-level field. That way, you can do anything to the Form-A
while in Form-B. At least that's what it looks like you are after...

Something like:

FormA.Textbox.Text = this.Textbox.Text;

on closing Form-B
 

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