Need urgent help - UserControl CausesValidation

laloush83

Member
Joined
Oct 26, 2005
Messages
9
Programming Experience
Beginner
hi,
I have a UserControl that contains several buttons,
clicking any button of this usercontrol causes validation for a separate textbox.. I need to know how can I distinguish wich button was clicked and caused the validation coz the handling of the textbox validating depends on wich button was clicked.
 
Hi, add the handles clause for all the button in one click event handler then
when it is clicked cast, using the sender parameter, to the button that was clicked....

VB.NET:
Expand Collapse Copy
Private Sub Button1_Click(byval sender as object, byval e as system.eventargs) 
handles button1_click, button2_click, button3_click
 
dim Btn as button = ctype(sender,button)
'Btn is now the button that raised the event.
 
Back
Top