J
Jeronimo Bertran
Hello,
I need to create a menu dynamically where the number of items is variable
but I don't know how to add a single click event handler with a way to
distinguish which item caused the click event:
foreach (MyType obj in ObjectTypes)
{
MenuItem item = new MenuItem(obj.title);
// Ideally pass on obj.id to the event handler.
item.Click += new System.EventHandler(this.typedMenuItem_Click);
menuItemFileNew.MenuItems.Add(item);
}
Thanks,
Jeronimo
I need to create a menu dynamically where the number of items is variable
but I don't know how to add a single click event handler with a way to
distinguish which item caused the click event:
foreach (MyType obj in ObjectTypes)
{
MenuItem item = new MenuItem(obj.title);
// Ideally pass on obj.id to the event handler.
item.Click += new System.EventHandler(this.typedMenuItem_Click);
menuItemFileNew.MenuItems.Add(item);
}
Thanks,
Jeronimo