Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1155
  • Last Modified:

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

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
VirtueTech
Asked:
VirtueTech
  • 5
  • 3
1 Solution
 
Jaime OlivaresCommented:
your mdi child has an MDIParent property.
But you have to cast it properly before using:

((your_mdiform_classname)this.MDIParent).somemethod();
0
 
VirtueTechAuthor Commented:
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
 
Jaime OlivaresCommented:
sorry, it should be MdiParent
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
VirtueTechAuthor Commented:
Thanks.  
0
 
VirtueTechAuthor Commented:
How Can I do this from the Child MDI form?

Meaning how can I call a Parent method from the child?
0
 
Jaime OlivaresCommented:
Something like I stated earlier:

((your_mdiparentform_classname)this.MdiParent).somemethod();
0
 
VirtueTechAuthor Commented:
Yeah...I was tryng something like that, trying to use Intellisense to figure it out, but I had no luck.
0
 
VirtueTechAuthor Commented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now