Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top