2
Answers

How to dispatch Click event on Label?

Ask a question
Fiona

Fiona

15y
9.3k
1
Hi,

I have a very simple question.
In a Windows Form, I have a series of Labels which have several Event Handlers defined.

When a button is clicked, I would like to loop through all these Labels and dispatch the Click event on each.
Now, if they were buttons, I could simply call label.PerformClick(), but this doesn't exist for Labels (and, no, I can't change them to buttons!).

So, how do I dispatch the Click event (or any of the other built-in events) for a control?

(From an ActionScript perspective, this would be simply label.dispatchEvent(new Event(MouseEvent.CLICK)) )

Thanks for your help.

Answers (2)