Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
If e.Button = Windows.Forms.MouseButtons.Right Then
Dim NewContext As ContextMenuStrip = ContextMenuStrip1
Me.ContextMenuStrip = NewContext
Me.ContextMenuStrip.Show(Me, New Point(e.X, e.Y))
End If
End Sub
ToolStripDropDown.Closing Event (System.Windows.Forms)Consider handling the Closing event instead of setting the AutoClose property.
Private Sub ContextMenuStrip1_Closing(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolStripDropDownClosingEventArgs) Handles ContextMenuStrip1.Closing
e.Cancel = True
End Sub