Solved

MDI Forms

Posted on 2003-12-08
2
621 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
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now