Assuming this is Windows Forms:
Controls inheriting from Control/ButtonBase, like a Button, provide a method for triggering a Click Event in code: 'PerformClick();
For other Controls, depending on the Control, and what you want to do, different techniques can be used.
In one use-case you may want to simulate an actual physical mouse-click on a Control, which would, normally, give Focus to the Control; in another use-case, perhaps your goal is simply execute to the code in the Click EventHandler. Or, perhaps, you want both behaviors ?
You can usually "get away with" invoking a Click EventHandler's code by simply calling it with "dummy" parameter arguments:
private void SomeMethod( ... some parameters , , ,)
{
SomeControl_Click(null, null);
}
Begin Edit:
As OriginalGriff notes in his response, if you are going to make use of the code in an EventHandler from outside the EventHandler, it is much better to take that code and put it in a method of its own which both the EventHandler and your "external" code can call.
If you really wish to
simulate a physical mouse-click anywhere on the screen, you must use the Win API: good source code here: [
^]. If you are a beginner in C# and .NET, I'd suggest you wait until you are more advanced before using API based code.
End Edit
If you give a specific example of what you are trying to do, and what Controls are involved, you can get a more specific answer.