I want to add an event in my VB.NET code. I have done VB.net programming but not well experienced in event handling.
I have declared like this
public WithEvents FormEventCapture As vFormAgent.__vFormAgentLib_Event
Then i put the following code in form load event
FormEventCapture = new vFormAgent.__vFormAgentLib_FormEventEventHandler()
AddHandler FormEventCapture.FormEvent, AddressOf Me.FormEventCapture_FormEvent
Is it correct?
When i compile i get the following error
Delegate 'vFormAgent.__vFormAgentLib_FormEventEventHandler' requires an 'AddressOf' expression or lambda expression as the only argument to its constructor. (BC32008)
So i need to pass an argument to this constructor then i changed as follows
FormEventCapture = new vFormAgent.__vFormAgentLib_FormEventEventHandler(AddressOf Me.FormEventCapture_FormEvent)
Then i get the following error
Lambda expression cannot be converted to 'vFormAgent.__vFormAgentLib_Event' because 'vFormAgent.__vFormAgentLib_Event' is not a delegate type. (BC36625)
I am not able to figure out what is the problem.
Can any one tell me what is the problem?