I've been asking about a Menu problem I have without results.
So here is a test case I've developed that shows the problem.
Simply create a soultion with one project containg one form and replace the
form code with this.
Run it, right click and select Edit/Paste Special/Test1
Then try to do that again
I beleive that Test1 will not show the second time!
How come?
Thanks
Public Class FormlTest
Inherits System.Windows. Forms.Form
#Region "Windows Form Designer generated code "
Public Sub New()
MyBase.New()
InitializeCompo nent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not components Is Nothing Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private components As System.Componen tModel.IContain er
Friend WithEvents MenuItemEdit As System.Windows. Forms.MenuItem
Friend WithEvents MenuItemPasteSp ecial As System.Windows. Forms.MenuItem
Private WithEvents ContextMenuEdit or As System.Windows. Forms.ContextMe nu
Private Sub InitializeCompo nent()
Me.ContextMenuE ditor = New System.Windows. Forms.ContextMe nu
Me.MenuItemEdit = New System.Windows. Forms.MenuItem
Me.MenuItemPast eSpecial = New System.Windows. Forms.MenuItem
'
'ContextMenuEdi tor
'
Me.ContextMenuE ditor.MenuItems .AddRange(New System.Windows. Forms.MenuItem( )
{Me.MenuItemEdi t})
'
'MenuItemEdit
'
Me.MenuItemEdit .Index = 0
Me.MenuItemEdit .MenuItems.AddR ange(New System.Windows. Forms.MenuItem( )
{Me.MenuItemPas teSpecial})
Me.MenuItemEdit .Text = "Edit"
'
'MenuItemPasteS pecial
'
Me.MenuItemPast eSpecial.Index = 0
Me.MenuItemPast eSpecial.Text = "Paste Special"
'
'FormlTest
'
Me.AutoScaleBas eSize = New System.Drawing. Size(6, 14)
Me.BackColor = System.Drawing. Color.Blue
Me.ClientSize = New System.Drawing. Size(768, 437)
Me.Name = "FormlTest"
End Sub
#End Region
Private Sub FormlEditor_Mou seUp(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles MyBase.MouseUp
If e.Button = MouseButtons.Ri ght Then ContextMenuEdit or.Show(Me, New
Point(e.X, e.Y))
End Sub
Private Sub ZZ_Click(ByVal sender As Object, ByVal e As System.EventArg s)
End Sub
Private Sub ContextMenuEdit or_Popup(ByVal sender As Object, ByVal e As
System.EventArg s) Handles ContextMenuEdit or.Popup
Dim lMsg As String
Dim jnk
MenuItemPasteSp ecial.MenuItems .Clear()
MenuItemPasteSp ecial.MenuItems .Add(New MenuItem("Test1 ", AddressOf
ZZ_Click))
MenuItemPasteSp ecial.MenuItems .Add(New MenuItem("Test2 ", AddressOf
ZZ_Click))
End Sub
End Class
So here is a test case I've developed that shows the problem.
Simply create a soultion with one project containg one form and replace the
form code with this.
Run it, right click and select Edit/Paste Special/Test1
Then try to do that again
I beleive that Test1 will not show the second time!
How come?
Thanks
Public Class FormlTest
Inherits System.Windows. Forms.Form
#Region "Windows Form Designer generated code "
Public Sub New()
MyBase.New()
InitializeCompo nent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not components Is Nothing Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private components As System.Componen tModel.IContain er
Friend WithEvents MenuItemEdit As System.Windows. Forms.MenuItem
Friend WithEvents MenuItemPasteSp ecial As System.Windows. Forms.MenuItem
Private WithEvents ContextMenuEdit or As System.Windows. Forms.ContextMe nu
Private Sub InitializeCompo nent()
Me.ContextMenuE ditor = New System.Windows. Forms.ContextMe nu
Me.MenuItemEdit = New System.Windows. Forms.MenuItem
Me.MenuItemPast eSpecial = New System.Windows. Forms.MenuItem
'
'ContextMenuEdi tor
'
Me.ContextMenuE ditor.MenuItems .AddRange(New System.Windows. Forms.MenuItem( )
{Me.MenuItemEdi t})
'
'MenuItemEdit
'
Me.MenuItemEdit .Index = 0
Me.MenuItemEdit .MenuItems.AddR ange(New System.Windows. Forms.MenuItem( )
{Me.MenuItemPas teSpecial})
Me.MenuItemEdit .Text = "Edit"
'
'MenuItemPasteS pecial
'
Me.MenuItemPast eSpecial.Index = 0
Me.MenuItemPast eSpecial.Text = "Paste Special"
'
'FormlTest
'
Me.AutoScaleBas eSize = New System.Drawing. Size(6, 14)
Me.BackColor = System.Drawing. Color.Blue
Me.ClientSize = New System.Drawing. Size(768, 437)
Me.Name = "FormlTest"
End Sub
#End Region
Private Sub FormlEditor_Mou seUp(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles MyBase.MouseUp
If e.Button = MouseButtons.Ri ght Then ContextMenuEdit or.Show(Me, New
Point(e.X, e.Y))
End Sub
Private Sub ZZ_Click(ByVal sender As Object, ByVal e As System.EventArg s)
End Sub
Private Sub ContextMenuEdit or_Popup(ByVal sender As Object, ByVal e As
System.EventArg s) Handles ContextMenuEdit or.Popup
Dim lMsg As String
Dim jnk
MenuItemPasteSp ecial.MenuItems .Clear()
MenuItemPasteSp ecial.MenuItems .Add(New MenuItem("Test1 ", AddressOf
ZZ_Click))
MenuItemPasteSp ecial.MenuItems .Add(New MenuItem("Test2 ", AddressOf
ZZ_Click))
End Sub
End Class
Comment