Link to home
Start Free TrialLog in
Avatar of VirtueTech
VirtueTech

asked on

From an MDI application - Call MDI Child form method from the Parent form?

Hello,

"jaime_olivares" helped me on this question to call an MDI Parent Form method from a child form:
https://www.experts-exchange.com/questions/22983140/From-an-MDI-application-call-MDI-Parent-method-from-MDI-Child-And-Visa-Versa.html

Now I need to call a Child Forms method from its Parent. Anyone?


Here is my solution from "jaime_olivares" in the other question:
   ((MainForm2 )this.MDIParent).AddCamerastoButton();

NOTES:
- ChildMDItestForm = my Child form
- MainForm2 = my Parent Form
- AddCamerastoButton() method is on my MainForm2 = MDI Parent method
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

in a mdi application you can have many child forms, not just one, so, how do you know which to call?
Avatar of VirtueTech
VirtueTech

ASKER

I tried this but I get an error:
((ChildMDItestForm)this.MdiChildren).upgradeLayoutbyXML(1);

ERROR:
Cannot convert type 'System.Windows.Forms.Form[]' to 'SW24RC_DevEx.ChildMDItestForm'

Similar to your comment jaime...the error states that I need to know which child form, thus the array.

I'm using the MDI Manager from DevExpress, and where I need to call the Child form method is always on the selected/active child form.
MdiChildren is a collection. You have to pick one.
how?
ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you Jaime! You're full of information and have been extremely helpful!