Solved

From an MDI application call MDI Parent method from MDI Child - And Visa-Versa??

Posted on 2007-11-26
8
1,148 Views
Last Modified: 2013-12-16
I have an MDI Application:

How do I call a MDI Parent method from my MDI Child form?

And visa-versa - how do I call a MDI Child method from my MDI Parent?
0
Comment
Question by:VirtueTech
  • 5
  • 3
8 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20352098
your mdi child has an MDIParent property.
But you have to cast it properly before using:

((your_mdiform_classname)this.MDIParent).somemethod();
0
 

Author Comment

by:VirtueTech
ID: 20352215
I get an Error when making this call:
   ((MainForm2 )this.MDIParent).AddCamerastoButton();

ERROR:
'SW24RC_DevEx.ChildMDItestForm' does not contain a definition for 'MDIParent'      


NOTES:
- Strange this is "Intellisense" allows me to choose the MainForm2.AddCamerastoButton method.
- ChildMDItestForm = my Child form
- MainForm2 = my Parent Form
- AddCamerastoButton() method is on my MainForm2 = MDI Parent method

0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 20352276
sorry, it should be MdiParent
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Closing Comment

by:VirtueTech
ID: 31411045
Thanks.  
0
 

Author Comment

by:VirtueTech
ID: 20352703
How Can I do this from the Child MDI form?

Meaning how can I call a Parent method from the child?
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20352926
Something like I stated earlier:

((your_mdiparentform_classname)this.MdiParent).somemethod();
0
 

Author Comment

by:VirtueTech
ID: 20353689
Yeah...I was tryng something like that, trying to use Intellisense to figure it out, but I had no luck.
0
 

Author Comment

by:VirtueTech
ID: 20354207
jaime - please reffer to the following NEW question on the subject of calling a Child method from the Parent Form:
http://www.experts-exchange.com/Microsoft/Development/.NET/Visual_CSharp/Q_22983879.html
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question