'AddHandler' and 'RemoveHandler' method parameters must have the same delegate type as the containing event
A Custom Event
declaration must have AddHandler
or RemoveHandler
declarations, each of which takes a single parameter of the delegate type specified by the custom event's As
clause.
Error ID: BC31136
- Change the type of the parameter to be the same as the delegate type specified by the custom event's
As
clause.
This example shows a custom event with the correct parameter types for the AddHandler
and RemoveHandler
declarations.
VB
Custom Event Test As System.EventHandler
AddHandler(ByVal value As System.EventHandler)
' Code for adding an event handler goes here.
End AddHandler
RemoveHandler(ByVal value As System.EventHandler)
' Code for removing an event handler goes here.
End RemoveHandler
RaiseEvent(ByVal sender As Object, ByVal e As EventArgs)
' Code for raising an event goes here.
End RaiseEvent
End Event
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: