Solved

Event swallowed with multiple handlers

Posted on 2006-11-10
1
210 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
pressing download button in c# 7 46
Coding for the first time 9 99
c# ftp code 3 56
asp.net, radiobuttonlist, c# 3 67
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

737 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