Question

I have a control which is a button and I want to manually click it. (When the user presses a button)

I have the control but I don't know how to get it's function. (The format of the click function is [Control.Name]_Click(object sender, EventArgs e) as usual

Does anyone know how to do this?

Était-ce utile?

La solution

If you have the button, instead of trying to find the method, I would recommend just calling Button.PerformClick instead. This will trigger all of the event handlers on the button's Click event, no matter what name they've been assigned.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top