C# Menu Control

A Menu on a Windows Form is created with a MainMenu object, which is a collection of MenuItem objects. MainMenu is the container for the Menu structure of the form and menus are made of MenuItem objects that represent individual parts of a menu.

You can add menus to Windows Forms at design time by adding the MainMenu component and then appending menu items to it using the Menu Designer.

C# menu-control

After drag the Menustrip on your form you can directly create the menu items by type a value into the "Type Here" box on the menubar part of your form. From the following picture you can understand how to create each menu items on mainmenu Object.

C# menubar

If you need a seperator bar , right click on your menu then go to insert->Seperator.

C# menu-seperator

After creating the Menu on the form , you have to double click on each menu item and write the programs there depends on your requirements. The following C# program shows how to show a messagebox when clicking a Menu item.

using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApplication1
    public partial class Form1 : Form
        public Form1()

        private void menu1ToolStripMenuItem_Click(object sender, EventArgs e)
            MessageBox.Show("You are selected MenuItem_1");
} (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About