HighTechTalks DotNet Forums  

Detect if an event has event handler

Dotnet General Discussions microsoft.public.dotnet.general


Discuss Detect if an event has event handler in the Dotnet General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
bz
 
Posts: n/a

Default Detect if an event has event handler - 11-18-2007 , 07:09 AM






Hi,

I need to bind the dropdown event to an event handler, but not from
beginning (in form's load or constructor), but little bit later, when
a background process completes.

Is there any way to detect if I already bound a handler to the event
(to not bind the handler several times)

Thank you

Reply With Quote
  #2  
Old   
bz
 
Posts: n/a

Default Re: Detect if an event has event handler - 11-18-2007 , 10:47 AM






On 18 Noi, 16:51, Mattias Sjögren <mattias.dont.want.s... (AT) mvps (DOT) org>
wrote:
Quote:
Is there any way to detect if I already bound a handler to the event
(to not bind the handler several times)

The easiest way is to just keep track of that in a boolean field.
I thought maybe it is a more elegant way

Thanks


Reply With Quote
  #3  
Old   
Henning Krause [MVP - Exchange]
 
Posts: n/a

Default Re: Detect if an event has event handler - 11-18-2007 , 10:55 AM



Hi,

if you attach the same handler from the same object instance twice, it will
still be only called once.

Kind regards,
Henning Krause



"bz" <bzamfir (AT) gmail (DOT) com> wrote

On 18 Noi, 16:51, Mattias Sjögren <mattias.dont.want.s... (AT) mvps (DOT) org>
wrote:
Quote:
Is there any way to detect if I already bound a handler to the event
(to not bind the handler several times)

The easiest way is to just keep track of that in a boolean field.
I thought maybe it is a more elegant way

Thanks



Reply With Quote
  #4  
Old   
Cor Ligthert[MVP]
 
Posts: n/a

Default Re: Detect if an event has event handler - 11-19-2007 , 12:55 AM



bz.

ind in files.

An event method can as well be used without an event.

Cor

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.