In mine another forum i had a problem to declare a Form in another Form and they give me the result as follow:
//--------------------------
What I understood from the above is
You have Form1 with a TextBox and a Button
When you click Button it will open Form2
Form2 also has a Button
When you click the Button in Form2 you have toshw the Text in TextBox of Form1.
If my understanding is correct what you have to do is when you are calling Form2 pass the reference of Form1 either in Constructor or a member then you can access the Form1 TextBox(make sure you declare TextBox as Public in Form1)
Form1......
public partial class Form11 : Form
{
public Form11()
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
Form12 f = new Form12(this);
f.ShowDialog();
f.Dispose();
Form2.....
public partial class Form12 : Form
private Form11 _parent;
public Form12(Form11 form)
_parent = form;
string halo = _parent.textBox1.Text + " Form2";
MessageBox.Show(halo);
Hope This Helps
Copying from the IDE: Copy the code from the Visual Studio, see my code above
Now I have a extra Form that need to be add in Form12 called Form13. How can I do that in the same way as the above result ? I was looking the part of public Form12(Form11 form) but i can't find a result.