title: Handling ActiveX events on an Access form
body: <p>I have an ActiveX control for opening and manipulating a proprietary image type. I am able to embed the control in an Access form, and by using the Object Browser am able to ascertain all the class members. The only problem I am having is handling some of the events raised by the control.</p>
  
  <p>For example, from the Object Browser I can see the following event definition:</p>
  
  <pre><code>Event RightClicked()
  </code></pre>
  
  <p>And when I add the following code to the form:</p>
  
  <pre><code>Private Sub CtrlInstanceName_RightClicked()
    'Anything here
  End Sub
  </code></pre>
  
  <p>Everything works as expected. However, if the event declaration has parameters passed to it, such as:</p>
  
  <pre><code>Event MeasurementUpdated(id as Long)
  </code></pre>
  
  <p>Adding:</p>
  
  <pre><code>Private Sub CtrlInstanceName_MeasurementUpdated(id as Long)
    'Anything here
  End Sub
  </code></pre>
  
  <p>Produces the following error: </p>
  
  <blockquote>
    <p>The expression ... you entered as the event property setting produced
    the following error: Procedure declaration does not match description
    of event or procedure having the same name.</p>
  </blockquote>
  
  <p>Even more strange after adding this second handler, <strong>all event handlers</strong> on the form produce this error, including events raised by the form and other controls on the form.</p>
  
  <p>I have tested the ActiveX control in a C# .NET application and am able to handle the events there (although they don't quite work as expected). In Visual Studio, the function prototypes end up being a little odd with auto-defined event handler class types.</p>
  
  <p>Any ideas on how I need to change the event procedure declaration to avoid this error?</p>