tonelm54
asked on
Tab Page ContextMenuStrip AddHandler
Good evening,
Im trying to add a ContextMenu strip to a tab page which adds different items, depending on the tab created.
I have 2 problems, the first is when I run the line 'tp.ContextMenuStrip.Items .Add("Clos e this")' I get 'Object reference not set to an instance of an object.'
And if I set it as a context menu and add a static menu (not what I wanna do), my handeler doesnt work.
Any ideas?
Im trying to add a ContextMenu strip to a tab page which adds different items, depending on the tab created.
I have 2 problems, the first is when I run the line 'tp.ContextMenuStrip.Items
And if I set it as a context menu and add a static menu (not what I wanna do), my handeler doesnt work.
Any ideas?
Dim tp As New TabPage
tp.Text = "Transactions for '" & e.ClickedItem.Text & "'"
tp.ContextMenuStrip.Items.Add("Close this")
tp.ContextMenuStrip.Items.Add("Close all but this")
tp.ContextMenuStrip.Items.Add("Close all")
AddHandler tp.ContextMenuStrip.Click, AddressOf tabContextMenuStripClick
tcWindows.TabPages.Add(tp)
Private Sub tabContextMenuStripClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.