Click to See Complete Forum and Search --> : .Click feature question


Jym
November 19th, 2002, 01:02 PM
Explaination of my problem

I have 100 or so controls on a form.

I was wondering if there is a way to do an event when one of the controls is clicked ...

I know I can individually go through each control and set up the .click handler but since it's the same event no matter which control is clicked I was just wondering if there is a "broad" handler that would run an event if any control is clicked.

for a dynamically added control I am using

AddHandler lbl.Click, New System.EventHandler(AddressOf lbl_click)

but don't know if I can set up something for the 100 controls that are always on the form.

Thanks for you ideas

Jym

Athley
November 19th, 2002, 04:38 PM
Add as many click events as you want in the Handles clause of the event. Ex:

Private Sub EventProc(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Label1.Click, Label2.Click, Label3.Click, Textbox1.Click, Textbbox2.Click
'Your event code
End sub

/Leyan

Jym
November 19th, 2002, 07:36 PM
Ingenous !!!! and once again Thank you Athley (hmmm I'm saying that a lot wanna finish the program for me ? LOL )