title: Passing AddressOf to a function in VB.NET to use AddHandler
body: <p>I need to pass a reference of a function to another function in VB.NET. How can this be done?</p>
  
  <p>My function needs to use AddHandler internally, for which I need to pass it a handling function. My code below obviously does not work, but it conveys the idea of what I need.</p>
  
  <pre><code>Public Function CreateMenuItem(ByVal Name As String, ByRef Func As AddressOf ) As MenuItem
     Dim item As New MenuItem
  
     item.Name = Name
     'item.  other options
  
     AddHandler item.Click, AddressOf Func
  
     Return item
  End Function
  </code></pre>
  
  <p>Is there another way to do this? The AddHandler needs to be set to a passed parameter in a function somehow...</p>