Udostępnij za pośrednictwem


The type '<type name>' has no event named '<event name>'

The type specified in the error message has no event of that name. The example below attempts to call an unsupported event.

Private Sub Button1_Chew(ByVal sender as Object, ByVal e as System.EventArgs) Handles Button1.Chew

End Sub

Note

C# users will not get an error with the following code:

private void button1_Chew(object sender, System.EventArgs e)
{

}

However, adding a line of code similar to the following to wire up the event handler will raise the error "System.Windows.Forms.Button does not contain a definition for Chew":

button1.Chew += new System.EventHandler(this.button1_Chew);

To correct this error

  • Use an event that is supported by that type.

See Also

Tasks

How to: Create Event Handlers at Run Time for Windows Forms

Concepts

Event Handlers Overview (Windows Forms)

Events Overview (Windows Forms)

Change History

Date

History

Reason

December 2009

Moved C# code out of the Procedure section.

Customer feedback.