Good morning.
Could you tell me about the subject matter?
VisualBasic (.NetFramework 4.0), VisualStudio 2010, Windows 7 (64Bit) dynamically generates and displays items from the context menu.
Some of the items on the menu have additional child items.
At this time, I am trying the ItemClicked event in ContextMenuStrip to detect that the item was selected, but it seems that the child item click cannot be detected in this event.
In this case, how do you detect clicks on all items (parent/child)?
Thank you for your cooperation.
.net vb.net
You can add an event handler to the ToolStripMenuItem
when you dynamically generate it using the AddHandler
statement.
'Dim item As ToolStripMenuItem
AddHandler item.Click,AddressOfitem_Click
…
Private Subitem_Click (sender As Object, eAs EventArgs)
…
End Sub
© 2024 OneMinuteCode. All rights reserved.