Having a problem merging a ContextMenuStrip for a UserControl to the MenuStrip on the form

  • Thread starter Thread starter academic
  • Start date Start date
A

academic

I'm having a problem merging a ContextMenuStrip for a UserControl to the
MenuStrip on the form containing the UserControl.

I tried the following thinking that it is equivalent to cloning the
ContextStrip menu

Thanks for Any helpful suggestions?





On the control



Public ReadOnly Property GetContextMenuControlWindowsExplorer() As
System.Windows.Forms.ContextMenuStrip

Get

Dim tmp As ContextMenuStrip = New ContextMenuStrip

ToolStripManager.Merge(ContextMenuControlWindowsExplorer, tmp)

'GetContextMenuControlWindowsExplorer = ContextMenuControlWindowsExplorer

GetContextMenuControlWindowsExplorer = tmp

End Get

End Property



On the form



Private Sub FixMenu()

'MenuStripThis is the forms MenuStrip

MenuStripThis.Items.Clear()

ToolStripManager.Merge(Me.MainMenuFormWindowsExplorerTool, MenuStripThis)

ToolStripManager.Merge(ControlWindowsExplorer1.GetContextMenuControlWindowsExplorer,
MenuStripThis)

End Sub
 
Back
Top