Programmatically click a C# button
Many times I am writing a c# application where a certain function needs to be performed on a timer event as well as from a user clicking a button. So in the effort of keeping the programmatic functionality the same as the user clicked event, we can programmatically click the button:
One could argue that it would be just as easy to to call a function from both locations such as ProcessData() instead of clicking the button programmatically, but the advantage is if a programmer in the future (or even you down the road) adds logic to the _Click event, it won’t be implemented in the triggered event (an event you or the new programmer may not remember or know occurs).



