Solved

Event swallowed with multiple handlers

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

705 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