No overload for matches delegate 'EventHandler' Error CS0123

In this post, I describe how to fix the error:

Compiler Error Message: CS0123: No overload for matches delegate 'EventHandler'

Screenshot of No overload for matches delegate 'EventHandler' Error CS0123

Cause

This error can occur when, in ASP.NET, you've created your own Web Control or User Control which contains an EventHandler e.g.

public event EventHandler CountChanged;

Then, when configuring the markup, you use Visual Studio to automatically create an event.

Screenshot of Create New Event

The method is automatically created in the code behind but it's missing the parameters e.g.

protected void WebUserControl_CountChanged()


Resolution

To resolve the issue, ensure the method parameters match the EventHandler e.g.

protected void WebUserControl_CountChanged(object sender, EventArgs e)

Comments

Popular posts from this blog

LG TV This app will now restart to free up more memory

LG TV Clear All Browsing History Data

Excel Import CSV not using "Use First Row as Headers"