Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello. Some code I'm writing creates a button at program startup. How can I change the event handler for the click event using code?

I'm sure I need to clarify this, but I can't really think of another way to put it. If you have questions, please ask and I will try and help clarify.

Thanks in advance!
Posted
Updated 24-Mar-11 10:51am
v3

If your trying to wire up the Click event for a button you just created in code, look into AddHandler[^]. If you're trying to remove the handler and replace it with something else, you'll also need RemoveHandler.
 
Share this answer
 
Comments
drummerboy0511 24-Mar-11 16:11pm    
I'm going to update the original post... that did help, but there's a new problem.

Thanks!
You should have posted a new question for this. The method you wire the MouseUp event to must match exactly, the header for the event. Why are you wiring MouseUp instead of Click??
 
Share this answer
 
Comments
drummerboy0511 25-Mar-11 11:12am    
You're right, I should have. Either way, you helped immensely. I'll revert the question back to the original.

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