title: VB.NET right button click event on dynamically created button
body: <p>Similar to: <a href="https://stackoverflow.com/questions/14566156/get-the-id-name-of-a-button-in-a-click-event-vb-net">Get the ID/Name of a button in a click event. VB.NET</a> ?</p>
  
  <p>I am looking to find whether the left or right button was clicked on a mouse.  I have declared a block class which holds buttons.  I've assigned an event to the button click through:</p>
  
  <pre><code>Class Block
    Public X As Integer
    Public Y As Integer
    Public type As String
    Public status As String
    Public text As String
    Public WithEvents button As Button
  
    Private Sub btnReveal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button.Click
    ....
    ....
    End Sub
  </code></pre>
  
  <p>This works fine, but when I try to pick up the right button click using:</p>
  
  <pre><code>    If e.Button = MouseButtons.Right Then
          MessageBox.Show("RH click")
      Else
          button.Text = text
          button.BackColor = Color.LightGray
      End If
  </code></pre>
  
  <p>It complains on e.Button:
       Button is not a member of System.EventArgs</p>
  
  <p>Any ideas?</p>