문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top