title: WinForms MenuItems syntax in C#
body: <p>I'm trying to code a basic Windows Form. I've got the code below so far. Visual Studio doesn't recognize any of the lines like this one <code>MainMenu.MenuItems.Add(itemFile);</code>. Any time I've used MenuItems, the program doesn't understand and gives me an error. I've checked a bunch of sites and tutorials and they all use this kind of syntax so I feel like I've made an error somewhere.</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  
  namespace Form
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
              MenuStrip MainMenu = new MenuStrip();
              this.MainMenuStrip = MainMenu;
  
              ToolStripMenuItem itemFile = new ToolStripMenuItem(&quot;&amp;File&quot;);
              ToolStripMenuItem itemNew = new ToolStripMenuItem(&quot;&amp;New&quot;);
  
              MainMenu.MenuItems.Add(itemFile);
              itemFile.MenuItems.Add(itemNew);
  
              ToolStripMenuItem itemFolder = new ToolStripMenuItem(&quot;&amp;Folder&quot;);
              itemNew.MenuItems.Add(itemFolder);
  
              MainMenu.MenuItems.Add(&quot;Save &amp;As&quot;);
          }
          
      }
  }
  
  </code></pre>