title: How to hide main menu if all menu items are hidden in C#
body: <p>I have main menu Called Entries. and it has many submenu items.
  base on setting submenu can be set visible = false.</p>
  
  <p>I want to hide Entries Main menu if all its submenus are hidden.</p>
  
  <p>Here I try</p>
  
  <pre><code>int Count = 0;
  foreach (ToolStripDropDownItem mnu in entriesToolStripMenuItem.DropDownItems)
  {
      if (mnu.Visible)
      {
          Count++;
      }
  }
  if (Count == 0)
  {
      entriesToolStripMenuItem.Visible = false;
  }
  </code></pre>
  
  <p>but problem is that <code>if (mnu.Visible)</code> always returns false because submenu visible property is false due to Entries main menu not expanded. when I click on Entries then sub menus item's visible property is coming = true.</p>
  
  <p>I want to hide it in form load event.</p>