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