'Return' statement in an 'AddHandler', 'RemoveHandler', or 'RaiseEvent' method cannot return a value

The AddHandler, RemoveHandler, and RaiseEvent methods in a Custom Event declaration can contain Return statements to exit the methods. However, the Return statement cannot specify a return value because the methods cannot return values.

Error ID: BC30940

To correct this error

  • Remove the expression following the Return statement.

See Also

Reference

Event Statement

AddHandler

RemoveHandler

RaiseEvent

Return Statement (Visual Basic)

Other Resources

Events in Visual Basic