Solved

Event swallowed with multiple handlers

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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 Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

13 Experts available now in Live!

Get 1:1 Help Now