Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ContextMenu question...

Status
Not open for further replies.

bmgmzp

Programmer
Aug 18, 2006
84
US
I have two listviews and both of them are associated with the same contextmenu. When the user clicks the 'select all' menu item in the contextmenu the click event of the menu item calls me.activecontrol so I know which listview was clicked on. This worked fine until I put the listviews into the split container.

Any suggestions on how I can fix this? I was trying to avoid having duplicates of the same contextmenu on my form for each listview.

Thanks
 
What is happening now when you right click one listview ?
You put the listviews in different containers ?
 
Yes, the listviews are in different panels in the same splitcontainer. I've associated the contextmenu with each listview and when I right click on either of the listviews the contextmenu appears, which is supposed to happen.

However, when I click on one of the menu items inside the contextmenu i'm using the Me.ActiveControl property in the click event of the menu item to determine which control I right clicked on.

This works inside every other type of container except a splitcontainer.

 
Awesome! Thanks! With your help this is how my code ended up. ;-)

If TypeOf Me.ActiveControl Is SplitContainer Then
MsgBox(Me.SplitContainer1.ActiveControl.Name)
Else
MsgBox(Me.ActiveControl.Name)
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top