Definition of the <MemberName> Procedure in the <class1Name> Class Differs from Definition in the <class2Name> Class

Description

The signature of the procedure used for handling an event differs from the signature specified in the delegate of this custom event.

Troubleshooting Tips

Change the signature of the procedure or the event delegate.

Example

Delegate MyEvent(a: Integer; b: String);

Class EventClass: Object
    Friend Event OnMyEvent: MyEvent;
    
    Sub MyEvent(Sender: Object; Args: IEventArgs);
    Var
        a: Integer;
        b: String;
    Begin
        If OnMyEvent <> Null Then
            OnMyEvent(a, b);
        End If;
    End Sub MyEvent;
    
End Class EventClass;

Class TestForm: Form
    Obj: EventClass;
    
    Sub TestFormOnCreate(Sender: Object; Args: IEventArgs);
    Begin
        Obj := New EventClass.Create;
        //Subscription for event
        Obj.OnMyEvent := HandleEvent;
    End Sub TestFormOnCreate;
    
    Sub HandleEvent(a: Integer; b: Double);
    Begin
        //Event handling
    End Sub HandleEvent;
End Class TestForm;

When the specified code is compiled, the following error is displayed: Definition of the HandleEvent procedure in the TestForm class differs from definition of the event in the EventClass> class. To resolve the error, specify the same type of the "b" parameter in the description of the HandleEvent procedure and in the MyEvent delegate.

See also:

Compiler Messages