Hi,
this code works for my listBox:
(myFormMenuItem Delete and myFormMenuItemE dit must be defined as context menu
items)
' Only act on the right-button-click event to display the context menu
If e.Button = Windows.Forms.M ouseButtons.Rig ht Then
Try
Dim myListViewItem As ListViewItem = myFormListView. GetItemAt(e.X, e.Y)
' Only if the user clicked on a valid ListViewItem
If Not myListViewItem Is Nothing Then
myFormMenuItemD elete.Enabled = True
myFormMenuItemE dit.Enabled = True
myIndex= myListViewItem. Index()
Else
' The user did not richt-click on one of the ListView items
myFormMenuItemD elete.Enabled = False
myFormMenuItemE dit.Enabled = False
End If
Catch ex As Exception
myFormMenuItemD elete.Enabled = False
myFormMenuItemE dit.Enabled = False
MsgBox(ex.ToStr ing)
End Try
End If
Hope this helps,
Josef
"Hardik Shah" <ha********@hot mail.com> schrieb im Newsbeitrag
news:u4******** ******@TK2MSFTN GP11.phx.gbl...
Hi,
I want to create menu , when my user right click from combo box's list
item.
I use Contextmenu property of combobox and assign menu for it, but it only
effected when combobox's list item not active. When my user on any
combobox's item and he right click the mouse , menu doesn't appear.
How to create menu.
Thanks in advance.
Hardik Shah.