if there is another question that explains this I apologize for not being able to find it, but I think it might have to do with my unfamiliarity with some of the terms involved with what I’m trying to do.
What I’m trying to do is to add an eventhandler to a button by name. So for example, in the code below instead of knowing that I want to add showInfo, can I reference the EventHandler by name (string) like “showInfo”?
myButton.Click += new EventHandler(showInfo);
void showInfo(object sender, EventArgs e)
{
// ..
}
You can create a delegate from a method via reflection, and then subscribe that to the event via reflection, yes. Sample code: