Question Event Handling with User Controls

Lachy

Member
Joined
Dec 19, 2008
Messages
5
Programming Experience
5-10
Hi,

How can I handle the event where the user control is clicked when I'm creating the control at runtime?

I have it partially working using the AddHandler method, but it only works if I click the background area of the control is clicked, and won't work if I click say a label on that control. Is it possible to have it work so that this event is called no matter where I click inside the control?
 
Last edited:
Public Event on the User control, then raise the event in the user control's event i.e. a label's click event. You can also send data thru this event (byval str as string) then the str is a string the you can send to the form calling it.
then you add the addhandler(addressof 'YourRoutedSub')on the the form calling it, and make a sub(called a routing sub - 'YourRoutedSub') keeping the signatures the same-(byval str as string)-, that handles the code you want when this event is called (addhandler). If you need more specifics let me know.
 
Back
Top