mickn66 Posted July 5, 2003 Posted July 5, 2003 Ok, here's the situation. My program creates in code a context menu called mnuContextMenu, to which I add menuitems with code like mnuContextMenu.MenuItems.Add(txt.Text). I want all of the items in this context menu to do the same things when clicked, namely copy the text of the menuitem to the clipboard. I know how to copy things to the clipboard, what I don't know how to do is create an event handler for these programmatically-added menuItems. Please help! Thanks. Quote
starcraft Posted July 5, 2003 Posted July 5, 2003 you can try someing like this: Me.MenuItem2.Index = 0 Me.MenuItem2.MenuItems.AddRange(New System.Windows.Forms.MenuItem() ) Me.MenuItem2.Text = "Enter Text" i dont know if it will work but try that Quote
*Experts* mutant Posted July 5, 2003 *Experts* Posted July 5, 2003 AddHandler object.Event, AddressOf handlersub Where handlersub is the sub that will handle the event, it must also accept arguments that correspond to the event. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.