469,904 Members | 2,402 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,904 developers. It's quick & easy.

Would someone pass this on to MS and/or check to see it the problem persists in 2005

Would someone pass this on to MS and/or check to see it the problem persists
in 2005?

I don't have 2005 and do not know how to pass it on.

Nor do I have the time to spend learning how unless it really easy.

However, I spent much time on this and would like to see what I've learned
put to use.

The code below only has a few statements not created by the IDE:

When run, the second "Show" displays neither Test1 nor Test2.

I've reduced it to the very smallest code, removing many things I've tried
(including the EventHandlers).

Of course no one would do this but this is a reduction of code that make
more sense.

Thanks

Public Class FormTest

Inherits System.Windows.Forms.Form

#Region "Windows Form Designer generated code "

Public Sub New()

MyBase.New()

InitializeComponent()

End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not components Is Nothing Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub

Private components As System.ComponentModel.IContainer

Friend WithEvents MenuItemEdit As System.Windows.Forms.MenuItem

Private WithEvents ContextMenuTest As System.Windows.Forms.ContextMenu

Private Sub InitializeComponent()

Me.ContextMenuTest = New System.Windows.Forms.ContextMenu

Me.MenuItemEdit = New System.Windows.Forms.MenuItem

'

'ContextMenuTest

'

Me.ContextMenuTest.MenuItems.AddRange(New System.Windows.Forms.MenuItem()
{Me.MenuItemEdit})

'

'MenuItemEdit

'

Me.MenuItemEdit.Index = 0

Me.MenuItemEdit.Text = "Edit"

'

'FormTest

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(639, 405)

Me.Name = "FormTest"

End Sub

#End Region

Private Sub FormTest_MouseUp(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles MyBase.MouseUp

If e.Button = MouseButtons.Right Then

MenuItemEdit.MenuItems.Add(New MenuItem("Test1"))

ContextMenuTest.Show(Me, New Point(e.X, e.Y))

MenuItemEdit.MenuItems.Add(New MenuItem("Test2"))

ContextMenuTest.Show(Me, New Point(e.X, e.Y))

End If

End Sub

End Class


Nov 21 '05 #1
0 956

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Rtritell | last post: by
7 posts views Thread by Minnie | last post: by
8 posts views Thread by Sandy | last post: by
1 post views Thread by Jon Skeet [C# MVP] | last post: by
2 posts views Thread by mrimalka | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.