If I write
Dim th As new Thread
AddHandler th.Run, AddressOf myMethod
I get at the second line this error:
I do not understand what it means.
Th.Run is an event
AddreddOf myMethod is a Delegate because myMethod exists.
Can anyone give me some light on this? Thanks.
The error message is telling you that the method signature for the delegate doesn’t match the event it’s assigned to. Event handler methods need to receive the object that’s raising the event as their first parameter:
Sub MyMethod(Sender As Thread)
Thanks Andrew. I understand now.