i want to create a context menu strip on run time but i got this error, please help me, i tried to search on the net but i cant fine any solution there...
my code is:
Expand|Select|Wrap|Line Numbers
- Imports System.ComponentModel.CancelEventArgs
- Public Class VinteryBase
- Private m_New As Boolean
- Sub CreateMenu()
- Dim mnuItem As ToolStripMenuItem
- If m_New = True Then
- mnuItem = New ToolStripMenuItem("&New")
- AddHandler mnuItem.Click, cms_Opening >>>>this line is the error
- End If
- End Sub
- Sub cms_Opening(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
- ' Acquire references to the owning control and item.
- Dim c As Control = contextMenu.SourceControl
- Dim tsi As ToolStripDropDownItem = contextMenu.OwnerItem
- ' Clear the ContextMenuStrip control's
- ' Items collection.
- contextMenu.Items.Clear()
- ' Check the source control first.
- If (c IsNot Nothing) Then
- ' Add custom item (Form)
- contextMenu.Items.Add(("Source: " + c.GetType().ToString()))
- ElseIf (tsi IsNot Nothing) Then
- ' Add custom item (ToolStripDropDownButton or ToolStripMenuItem)
- contextMenu.Items.Add(("Source: " + tsi.GetType().ToString()))
- End If
- ' Populate the ContextMenuStrip control with its default items.
- contextMenu.Items.Add("-")
- contextMenu.Items.Add("Apples")
- contextMenu.Items.Add("Oranges")
- contextMenu.Items.Add("Pears")
- ' Set Cancel to false.
- ' It is optimized to true based on empty entry.
- e.Cancel = False
- End Sub
- End Class
>>>>the error:
Error 2 Argument not specified for parameter 'e' of 'Public Sub cms_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs)'.