Generic methods cannot use 'Handles' clause

A generic Sub procedure includes a Handles clause in its declaration.

A Handles clause specifies a list of events that the Sub procedure handles. To be an event handler, the Sub procedure must have the same signature as each event it is to handle. A generic procedure can be created more than once, with signatures that Visual Basic cannot predict at compile time. Therefore, Visual Basic cannot guarantee a signature that matches those of the events in the Handles clause.

Error ID: BC32080

To correct this error

  • If the Sub procedure needs to be generic, remove the Handles clause from its declaration. Use the AddHandler Statement to associate this event handler with an event.

  • If the Sub procedure needs to use the Handles clause to associate events, remove the Of clause from its declaration. You must use a nongeneric procedure with Handles.

See Also

Concepts

Generic Types in Visual Basic

Events and Event Handlers