'RaiseEvent' method must have the same signature as the containing event's delegate type '<signature>'

A Custom Event declaration must have RaiseEvent declaration that has the same signature as the delegate type specified by the custom event's As clause.

For the signatures to match, the RaiseEvent declaration and the delegate must have the number of parameters, and the parameters types must match.

Error ID: BC31137

To correct this error

  • Change the parameters of the RaiseEvent declaration to match the parameters of the delegate type.

Example

This example shows a custom event with the correct parameter types for the RaiseEvent declaration.

Delegate Sub TestDelegate(ByVal sender As Object, ByVal i As Integer)
Custom Event Test As TestDelegate
    AddHandler(ByVal value As TestDelegate)
        ' Code for adding an event handler goes here. 
    End AddHandler 

    RemoveHandler(ByVal value As TestDelegate)
        ' Code for removing an event handler goes here. 
    End RemoveHandler 

    RaiseEvent(ByVal sender As Object, ByVal i As Integer)
        ' Code for raising an event goes here. 
    End RaiseEvent 
End Event

See Also

Reference

Event Statement

RaiseEvent

Delegate Statement

Other Resources

Events in Visual Basic