You can assign names to the items in theDropDownItems
, that corresponds with their Tag
s. For instance:
templatesToolStripMenuItem.DropDownItems.Add(new ToolStripMenuItem("Item text") { Tag = 1, Name = "item1" });
Thus you can get the desired item as follows:
templatesToolStripMenuItem.DropDownItems["item" + e.TemplateId].Text = e.NewName;