My question might be ambiguous but here is my situation :
I have a square array of pictureboxes on my form, each has a handler to open the ContextMenuStrip whose content is generated based on a directory. Each folder in the directory will create a ToolStripMenuItem and each files inside that folder will be represented inside the DropDownItems of said menu menu item. Upon clicking on a sub item of my menu the picturebox's image will change based on what menu item was clicked.
My problem arises when I try to find out which sub item was clicked. How can I find that out with the _Clicked event of the ContextMenuStrip ? Here is my attempt so far :
private void mstChooseTile_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
ContextMenuStrip s = (ContextMenuStrip)sender;
ToolStripMenuItem x = (ToolStripMenuItem)e.ClickedItem;
// Test to see if I can get the name
MessageBox.Show(x.DropDownItems[1].Name);
// Nope :(
}