I have a MenuStrip with lots of items and am trying to have on event they all subscribe to so I am trying to do menuStrip1.Items.OfType<ToolStripMenuItem>();
and for each one I do this:
menuitem.Click += new EventHandler(MenuItem_Click);
The problem is there is a ToolStripSeperatorItem which inherits off ToolStripMenuItem and that appears is my list of items and errors because it does not have a Click event.
How can I not include these in my OfType method?