Solved

MDI Forms

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

932 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