Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fire UserControl Click event 1

Status
Not open for further replies.

Promis

IS-IT--Management
Feb 19, 2003
6
US
Greetings,

I've got a problem that for the life of me I can't find a workable
solution.

In a nutshell, I have 6 label controls on a UserControl. Clicking any
of the labels fires the Click Event for the associated label.

I have created a class to build an 'array' of the user control. In the
class I add a newe instance of the UserControl and add a handler for
the Click event of the user control.

Everything works fine. If I click on a label the click event in the
user control fires for the label. If I click on the User Control the
class picks up and fires the Click event for the control.

What I now need to do is if one of the labels is click, I also want to
fire the underlying User Control click event. Just calling
UserControl_Click from Label1_Click does not fire the click event for
the user control so that the class can detect it.

How can I fire both the Label1_Click event and the UserControl_Click
event?

Thanks
 
Try something like:
Private Sub ClickEventForControls(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UserControl.Click,Label1.click
 
Thanks woyler,

I did figure it out however after several tries. It helps to get all the event references correct so that the event fires it can be trapped.
 
This post freaked me out.....

You said:

"Try something like:
Private Sub ClickEventForControls(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UserControl.Click,Label1.click "

So i tried that out and i was amazed to find that i could now click label1 and the event would fire even tho i did not make a label1.click event.

Just adding handles to subs will save some coding :p

Very helpful

Regards,

Akart

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top