Click here to Skip to main content
15,918,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Clicked event-handlers? My project has minimum 5 "buttons" and each on being clicked must show the corresponding user control.Using the .show and .hide methods looks not like its the right way of evoking the click event.

Is there a way of equating one button clicked event to all the buttons and forms
Posted
Comments
Gerhard_Louis 29-Jul-12 6:27am    
Thanks OriginalGriff.English Is not my first language so sometimes its difficult to explain exactly my problem..I like your answers.Concise and clear to the point

1 solution

Yes - just set the event handler to the same method in the designer.
Assuming your method exists:
1) Highlight your button.
2) Look at the Events in the Properties pane (via the "lightning bolt" button)
3) Select the appropriate event ("Click" for example) by clicking it once.
4) A drop down will appear at the right side of the property - click it to open.
5) Select your method name from the list.
6) Repeat for you other buttons.

The same method will now be called - you can find out which called it via the "sender" parameter.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900