What is the equivalent of the Handler clause in C#?

Asked

Viewed 47 times

1

I’m following this one tutorial to try to get Skype to automatically accept lost friendship. The tutorial is in VB and I have to translate code to C# the problem is when I got to part of Handler, i tried to translate the following code:

Private Sub auoAdd(uName As Skype4comlib.user) Handles Skype1.UserAuthorizationRequestReceived

End Sub

In this website he ignores the clause Handles, someone knows how to write the Handler part up for C#?

1 answer

2


C# works differently compared to VB.NET. Add the following at the initialization of your class:

Skype1.UserAuthorizationRequestReceived += auoAdd;

Where auoAdd is the method that when the event is triggered, it will execute and Skype1.UserAuthorizationRequestReceivedis the event. The equivalent of this in VB.NET is the instruction AddHandler.

The method auoAdd will remain so:

public void auoAdd(uName As Skype4comlib.user)
{
    // Seu código
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.