Detect if an event has event handler

B

bz

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
 
M

Mattias Sjögren

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.


Mattias
 
H

Henning Krause [MVP - Exchange]

Hi,

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

Kind regards,
Henning Krause



The easiest way is to just keep track of that in a boolean field.

I thought maybe it is a more elegant way

Thanks
 
M

Mattias Sjögren

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

No, it will be called once for each time you add it.


Mattias
 
C

Cor Ligthert[MVP]

bz.

ind in files.

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

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top