Hi Jim,
Based on my understainding, you want to find a way to pass data from one
child form to another child form in MDI application.
To pass data to another form, you should have a reference of that form. For
your applicaiton, I think you should create a public property for parent
form, which stores all the child forms' reference. Then each child form can
refer other child form through the public property.
I write a sample like this:
In ParentForm:
public ArrayList FormList=null;
private void ParentForm_Load(object sender, System.EventArgs e)
{
FormList=new ArrayList();
FormX fx=new FormX();
fx.MdiParent=this;
fx.Show();
FormList.Add(fx);
FormY fy=new FormY();
fy.MdiParent =this;
fy.Show();
FormList.Add(fy);
}
For FormY, because its TextBox is a private variable, you should expose it
through property or method, like this:
public void SetText(string str)
{
this.textBox1.Text =str;
}
Then, in FormX, you can pass data like this:
private void button1_Click(object sender, System.EventArgs e)
{
ParentForm pf=(ParentForm)this.MdiParent;
foreach(object obj in pf.FormList)
{
Form f=(Form)obj;
if(f.Name.Equals("FormY"))
{
FormY fy=f as FormY;
fy.SetText("good");
}
}
}
===================================
Please apply my suggestion above and let me know if it helps resolve your
problem.
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.