context menu on listview

D

Darin

I have 2 listview's that have the same context menu tied to them. WHen
the user opens the context menu and clicks on one of the menu items, how
(within the handles mSelPrice_click) method can I tell which listview
they are on.

THanks.

Darin
 
T

The Grim Reaper

Assuming your click event sub is defined properly, as below, this should
work;

Private Sub mSelPrice_Click(ByVal sender As System.Object, e As
System.EventArgs) Handles mSelPrice_Click
Dim vClickedOnListview As String
vClickedOnListview = DirectCast(sender, Listview).Name
Messagebox.Show(vClickedOnListview)
End Sub

Obviously, you can use any property of the listview once you cast it, not
just the name.
____________________________
The Grim Reaper
 
H

Herfried K. Wagner [MVP]

* Darin said:
I have 2 listview's that have the same context menu tied to them. WHen
the user opens the context menu and clicks on one of the menu items, how
(within the handles mSelPrice_click) method can I tell which listview
they are on.

Check the context menu's 'SourceControl' property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top