C#/J# Find function by name / Manual control click
题
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.
不隶属于 StackOverflow