P
PJ Olson
I have a context menu associated with a tray icon. On the context menu, I
have a menuitem that is populated with sub menuitems at run time. When the
user right-clicks the tray icon I populate the sub menuitems with the
following code:
Private Sub cmTray_Popup(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cmTray.Popup
miPresets.MenuItems.Clear()
Dim rb As New Windows.Forms.RadioButton
Dim mip As New MenuItem
For Each rb In gbPresets.Controls
If rb.Tag <> "" Then
mip.MenuItems.Add(rb.Text & " - " & rb.Tag, AddressOf mi_Click)
End If
Next
miPresets.MergeType = MenuMerge.Add
miPresets.MergeMenu(mip)
miPresets.Text = "Presets"
End Sub
This code works the first two times the context menu is popped up. After
that, the sub-menu items never appear again.
Can anyone help with this?
Thanks,
PJ
have a menuitem that is populated with sub menuitems at run time. When the
user right-clicks the tray icon I populate the sub menuitems with the
following code:
Private Sub cmTray_Popup(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cmTray.Popup
miPresets.MenuItems.Clear()
Dim rb As New Windows.Forms.RadioButton
Dim mip As New MenuItem
For Each rb In gbPresets.Controls
If rb.Tag <> "" Then
mip.MenuItems.Add(rb.Text & " - " & rb.Tag, AddressOf mi_Click)
End If
Next
miPresets.MergeType = MenuMerge.Add
miPresets.MergeMenu(mip)
miPresets.Text = "Presets"
End Sub
This code works the first two times the context menu is popped up. After
that, the sub-menu items never appear again.
Can anyone help with this?
Thanks,
PJ