title: How to loop through menu items
body: <p>I'm a starting VB programmer, and I have been trying to loop through menu items, but this error always comes up:</p>
  
  <blockquote>
    <p>Unable to cast object of type 'System.Windows.Forms.ToolStripMenuItem'
    to type 'System.Windows.Forms.MenuItem'.</p>
  </blockquote>
  
  <p>Here is my code </p>
  
  <pre><code>Function prop(ByVal objprop)
      For Each mnuitem As MenuItem In ColorsToolStripMenuItem.DropDownItems
          mnuitem.Checked = False
      Next
      Return Nothing
  End Function
  </code></pre>
  
  <p>Excuse my poor programming, but can somebody help me get this piece of code working? Thanks!</p>