title: Disable right-click to textboxes VB.net 2010
body: <p>I already use KeyPress event to avoid inputting of symbols or special characters (especially for query) but right click event is still functioning and be able to paste special characters and may cause a run-time error. Is there a way to prevent right-clicking on textboxes or can right-click but disable paste?</p>
  
  <pre><code>Private Sub txtLastName_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtLastName.KeyPress, txtFirstName.KeyPress, txtMiddleName.KeyPress
  
      If Not (Asc(e.KeyChar) = 8) Then
          Dim allowedChars As String = "abcdefghijklmnopqrstuvwxyz.- ,"
          If Not allowedChars.Contains(e.KeyChar.ToString.ToLower) Then
              e.KeyChar = ChrW(0)
              e.Handled = True
          End If
      End If
  
  End Sub
  </code></pre>