I have a method set for the click event handler in several ToolStripMenuItems buttons and tools.
I want to get the sender tag property to see what was clicked, but it looks like ToolStripMenuItems cannot be passed to Control.
How can I get the Tag property of both buttons and ToolStripMenuItems?
Here is a simplified version of my method.
private void menu_Click(object sender, EventArgs e)
{
switch (((Control)sender).Tag.ToString())
{
case "X":
break;
case "Y":
break;
default:
break;
}
}
Thank!
source
share