473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Calling mdichild method from other mdichild

I have a MDI app wich has several different forms

I need to call a method on one MDIchild form from another child form.

I have a MDI form called frmMDI.
I have a mdichild form called frmMain.
I have a mdichild form called frmDetails.

after saving changes to frmDetails I need to update frmMain

I have a public method on frmMain to do this but I can't figure out how to
call this methos form frmDetails

any help

Mick
Nov 15 '05 #1
1 3061

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.

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Supra | last post by:
i got mdichild working. i'm working on similar to mirc chat. when i joined channel #vb the first mdichild is on. then when i wanted to join another channel #visualbasic. then i got second mdichild...
5
by: Shaun Pudwell | last post by:
Hi, I'm new to c# and come from a C / C++ background. My MainWindow class has a function called DrawChart. I open an MDI Child Window and want it to make a call from its class MDIChild to...
6
by: Claus Holm | last post by:
I'm trying to enable a menuitem in the parent form from a mdichild. Rather than making the menuitems public, I'd go for a public method in the parent form to do the change, but when I call the...
2
by: SpotNet | last post by:
Hello NewsGroup, I have a MDIParent form with a docked left treeview control, a splitter control and a generic docked control on the right. Kind of looks like Windows Explorer, though it's...
7
by: VM | last post by:
Hi, Is it possible to open always only one instance of a MDIChild form? Say, if form A is already opened, just give it the focus. I tried declaring theMDIChild forms as private members of the...
0
by: Supra | last post by:
i got mdichild working. i'm working on similar to mirc chat. when i joined channel #vb the first mdichild is on. then when i wanted to join another channel #visualbasic. then i got second mdichild...
0
by: Supra | last post by:
i got code working. similar to mirc chat. but what happen when i joined the channel #visualbasic...that fine with me , i got all data coming into first mdichild. but when i joined another channel...
5
by: Earl | last post by:
I need to call a method on an owned child form, and am wondering if the best way of doing this is to capture the Closing event of the form that passes control back to the form where I have the...
0
by: kardiss | last post by:
I am trying to add Meebo's "Pop-out" kinda feature to my application which when a button is pressed in a MdiChild form, it kicks that MdiChild form out of the MdiParent boundary and acts like a SDI...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.