Invoke a Method in an MDI Child from it's Parent

Z

zacks

Forgive me if this has been already asked an answered, I did do a
search both here and in VS2005 Help, but I can't find the answer to my
question.

I am developing an MDI application that is a speciality XML file
editor, used to create and edit a special XML file. It is an MDI app
since I want users to be able to have multiple XML files open at the
same time.

The parent form has the usual Menu bar with a File menu that has the
typical New, Open, Save, Save As type of menu items. The New and Open
items work fine, opening a new child window and feeding it the XML
filename to process. The child form has a Save command button on it's
tool bar that I use to save the XML file being editing in the current
child window.

What I would like to do is implement the parent window's File Save
functions, but I can't figure out how to tell the child window to
perform it's save method from the parent. I can find the active child
window and I can send data to it but for the life of me I can't figure
out how to invoke a method in the child form's class.

Any help would be appreciated.
 
R

rowe_newsgroups

Forgive me if this has been already asked an answered, I did do a
search both here and in VS2005 Help, but I can't find the answer to my
question.

I am developing an MDI application that is a speciality XML file
editor, used to create and edit a special XML file. It is an MDI app
since I want users to be able to have multiple XML files open at the
same time.

The parent form has the usual Menu bar with a File menu that has the
typical New, Open, Save, Save As type of menu items. The New and Open
items work fine, opening a new child window and feeding it the XML
filename to process. The child form has a Save command button on it's
tool bar that I use to save the XML file being editing in the current
child window.

What I would like to do is implement the parent window's File Save
functions, but I can't figure out how to tell the child window to
perform it's save method from the parent. I can find the active child
window and I can send data to it but for the life of me I can't figure
out how to invoke a method in the child form's class.

Any help would be appreciated.

Why can't you just cast the MdiChild into the appropriate type and
call the method as normal?

Thanks,

Seth Rowe
 
Z

zacks

Why can't you just cast the MdiChild into the appropriate type and
call the method as normal?

DAMN, the answer was so simple I was overlooking it. I was assigning
the active child form to an Form object. I needed to create the object
as the actual child form datatype itself.
 
P

Phillip Ross Taylor

DAMN, the answer was so simple I was overlooking it. I was assigning
the active child form to an Form object. I needed to create the object
as the actual child form datatype itself.

Also you can put a menu bar on the mdi child form with Save, Edit and
things like that. Windows will automatically MERGE both the parent and
child into the single parent menu at runtime which is real nice. then
all the handlers and events can be in the child and you can
concentrate on working on each child window at a time without having
to keep worrying about events in the parent window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top