Solved

Event swallowed with multiple handlers

Posted on 2006-11-10
1
209 Views
Last Modified: 2010-04-16
I have a windows forms application that needs to react to a BindingSource.CurrentChanged event. In fact, I have two different objects that need to handle the event. The form that contains the BindingSource needs to handle the event and another object owned by the form needs to handle the event. I have wired the event for the owned object handler and it works just fine. But, once I wire the event handler for the form as well, the owned object handler is never called. It is as if the wiring of the form's event handler has "unwired" the owned object handler. Can somebody please tell me what I'm doing wrong. Thanks!
0
Comment
Question by:Paracom_Inc
1 Comment
 
LVL 13

Accepted Solution

by:
AngryBinary earned 500 total points
ID: 17918268
When assigning multiple EventHandlers, you can use the "+=" shorthand. Here's an example:

Form1.Load += new System.EventHandler(Form1.loadHandler1);
Form1.Load += new System.EventHandler(Form1.loadHandler2);

On the Load event, both the loadHandler1 and loadHandler2 methods will be called.

Cheers,
--Randall
0

Featured Post

Independent Software Vendors: 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

Suggested Solutions

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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