all groups > dotnet compact framework > december 2006 >
You're in the

dotnet compact framework

group:

Dynamic menu and item clicked


Re: Dynamic menu and item clicked Daniel Moth 2
12/25/2006 9:06:37 PM
dotnet compact framework:
Your solution is to add an event handler to the menuitem (with
AddHandler) before adding it to the collection.

Cheers
Daniel
--
http://www.danielmoth.com/Blog

[quoted text, click to view]
Dynamic menu and item clicked William LaMartin
12/25/2006 11:36:14 PM
I recall being able to do this in Vb.net, but I can seem to find a way to
accomplish it in the compact framework.

I want to connect to a compact SQL database, get the list of tables and
display them in a menu. I have no trouble doing this. My problem begins
when I want to retrieve the text of the menu item when one of these
dynamically created menu items is clicked.

In VB.net I could add an item to the menu as follows.

mnuMain.MenuItems.Add("Menu Caption", AddressOf MenuItem_Click)

That allowed me to associate handler for the click event. However, in the
compact framework I can only add a Windows.Forms.MenuItem--with no method
that I see of associating a click event handler.

What is my solution?





Re: Dynamic menu and item clicked William LaMartin
12/26/2006 10:27:53 AM
Thanks very much. That did the trick.

[quoted text, click to view]

AddThis Social Bookmark Button