Solved

MDI Forms

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

829 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