It's not entirely obvious from your post, but I assume you want the text
from Form2 to become visible in Form1 without the user carrying out any
specific action, such as clicking a button that says "Fill Form1", or
something.
In that case, what you want, I guess, is to be able somewhere in code in
Form2 to be able to do something like:
Form1.FillTextBox(SomeString);
This means that you need a reference to Form1 in Form2. The easiest way of
doing this is to provide Form2 with a constructor that passes in a reference
to Form1. In Form1, you provide the FillTextBox() method.
So, in Form1 you can do:
Form Form2 = new Form(this);
Form2.Visible = true;
Form2.Show();
(or whatever)
In the Form2 constructor, you can store the reference to Form1 in an
instance variable:
Form Form1Ref;
....
public Form2(Form formoneref)
{
...
Form1Ref = formoneref;
...
}
Then in Form2 somewhere you can do:
Form1Ref.FillTextBox(MyForm2TextBox.Text);
The code above is off the top of my head, and I don't usually do
Windows.Forms stuff, so the exact syntax might be a bit wayward: but you
should get the idea.
HTH
Peter
"Boki" <bo******@ms21.hinet.netwrote in message
news:11**********************@z28g2000prd.googlegr oups.com...
Hi All,
There are two forms, when some click happen, it fires to set form2's
viable as enable.
The form2 is for user to input some text and then the data need to be
collected into form1's textbox.
I have created a function call as public, but I still can't use it in
form2.
Please advice. Thanks!
Best regards,
Boki.