Solved

MDI Forms

Posted on 2003-12-08
2
625 Views
Last Modified: 2010-04-16
I have an MDI application.

When my parent opens a child form I am able to hook into the close event of the child form in my parent's code as follows:

          private void File_New_Click(object sender, System.EventArgs e)
          {
               NewPartitionForm1 objForm = new NewPartitionForm1();

               objForm.MdiParent = this;

               objForm.Closing += new CancelEventHandler(Form1_Closed);

               objForm.Show();
          }

How can I hook into events such as click events of buttons on my child though?

Thanks

Dave
0
Comment
Question by:daveamour
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 20

Accepted Solution

by:
TheAvenger earned 25 total points
ID: 9899918
objForm.MyButton.Click += new EventHandler (...);

but the MyButton should be a public variable or a public property that exposes the button. The other way is to make a public method of your control to receive the delegate and attach it to the control.
0
 
LVL 19

Author Comment

by:daveamour
ID: 9902752
Thanks, this works great.  Weird thing is I suspected this is how it works - ie make the button public which I'm sure I tried yesterday but it didn't work?  Oh well must have done something silly.

Thanks

Dave
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…

740 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