rfazendeiro Posted September 22, 2005 Posted September 22, 2005 Hi ppl, I have populated my listview with items form by database. I now want to add 2 context menu for diferent purpose im my list view: 1. If a user right clicks in an item that exist in my list view i want to show a context menu with options like "properties", "Delete", "edit", etc. 2. If a user right clicks in the list view where there is no items i want to show a diferent context menu like "add new item", "refresh", "list view", etc How can i do this? how do i know that the user right clicked on an item? thanks to all Quote
Machaira Posted September 22, 2005 Posted September 22, 2005 The following seems to work: Private Sub ListView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDown If Not (ListView1.GetItemAt(e.X, e.Y) Is Nothing) Then ListView1.ContextMenu = mnuItem Else ListView1.ContextMenu = mnuNoItem End If End Sub Quote Here's what I'm up to.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.