Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top