Hi Mickey,
Thanks for posting in this group.
Normally, when you create the child form in the parent form code, you
should store child form's reference in some fields, then you can call the
child form's method in parent form.
If you want to call parent form's method in child form, I think you need
find a way to pass parent form's reference to child form.
Normally, you'd better create an overrided constructor for child form which
takes a form refence parameter, then when you create the child form, you
can pass "this" pointer into child form's constructor to store it.
Code snippet like this:
//In Form1, create 2 child forms.
private Form2 f2;
private void frmMDI_Load(object sender, System.EventArgs e)
{
Form2 frmMain=new Form2();
f2=frmMain;//store Form2's reference in its private field f2, then you can
invoke Form2's method later.
Form3 frmDetails=new Form3(this);
}
//In Form3, create an overrided constructor which takes a Form reference as
parameter
private Form1 f;
public Form3(Form obj)
{
f=(frmMDI)obj;
//you already got a reference of parent form, then you can
invoke parent's method later
}
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.