Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want make timer to execute code written in button automatically instead of click the button, cauld any one help me ?
Posted
Comments
Sergey Alexandrovich Kryukov 19-Aug-13 2:20am    
Why timer? What do you want to achieve, why? And when you say "Button", the question is: which one? There are different types from unrelated libraries sharing this simple name. Exact type name, please.
—SA
Sadique KT 19-Aug-13 2:49am    
improve question....

1 solution

There are two ways to do this: the poor-idea-but-simple way: execute the Button.PerformClick method which will cause the button to react as if the user had clicked it.

The better way is to extract the code from your button event handler into a method, and call that from the two places. That way, you are free to remove the button, or replace it with a different control at a later date without affecting the timer code.
 
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