Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Event swallowed with multiple handlers

Posted on 2006-11-10
1
Medium Priority
?
214 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
[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
1 Comment
 
LVL 13

Accepted Solution

by:
AngryBinary earned 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Screencast - Getting to Know the Pipeline

610 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