I know this question has been asked many times, but I read the answers for other questions and my code still gives me an error
This is my code
Button loadButton = new Button();
loadButton.Text = "Load";
loadButton.Click += new EventHandler(this.openOutlook());
private void openOutlook()
{}
now I got error states method names expected on this line new EventHandler(this.openOutlook());
I tried to add object sender, EventsArg arg to the header of the method.
openOutlookmethod does not have the signature ofopenOutlook(object sender, EventArgs e)and when you invoke the method in your event handler, you need to ditch the brackets, since you are passing a function pointer (delegate).