hey guys,
this is what i want to do, i already have a ToolStripMenuItem with a few DropDownItems with events.
i would then like to loop through these Items like such:
foreach (object menuitem in tlstrpmnuitmFunctionHeader.DropDownItems)
{
}
and then assign these items to a ContextMenu. it would really cut down the codding length a lot of i can somehow retrieve the events assigned to the tools strip menu items and assign them to the ContextMenu items.
i've done something like this, but its obviously wrong!
foreach (object menuitem in tlstrpmnuitmFunctionHeader.DropDownItems)
{
RowHeaderMenu.MenuItems.Add(((ToolStripMenuItem)menuitem).Name, ((ToolStripMenuItem)menuitem).Click);
}
what i want is to get the onClick event assigned to the ToolStripMenuItem to be assigned to the RowHeaderMenu item as well. i'm currently doing the following, which is assign each event to the ContextMenu item one by one:
RowHeaderMenu.MenuItems.Add(((ToolStripMenuItem)menuitem).Text, Menu1_Click);
RowHeaderMenu.MenuItems.Add(((ToolStripMenuItem)menuitem).Text, Menu2_Click);
and on...and on...