How to add Menus to Windows Forms in C#

In this tutorials we are going to show you how to add menus to your forms. We`ll add File, Edit, View, and Help menus.

So create a new project by clicking FileàNew Project from the menu at the top of Visual Studio 2010 or ShortcutKeys Ctrl+Shift+N. Create a new Windows Forms Application project and call it anything you like. When your new form appears, you can add a menu bar quite easily.

Choose Toolbox on the left of Visual Studio 2010.
Click Common Controls, there is a section for Menus and Toolbars and now click the plus symbol next to this to see the following:


How to add Menus to Windows Forms C# Tutorials

Double click on MenuStrip and you will see a menu bar appear at the top of your form:

How to add Menus to Windows Forms C# Tutorials

To adding items to your menus is totally simple. Click inside of area at the top, where it says “Type Here”. Now type the word File.


How to add Menus to Windows Forms C# Tutorials

Now click Enter key on your keyboard and your menu will look like this:

How to add Menus to Windows Forms C# Tutorials


To add items to your File Menu, click inside of the second “Type Here” area picture above. Now type the word New. Click the Enter to add the menu item.

How to add Menus to Windows Forms C# Tutorials

Click back on the word New after you have click the enter key. Once create a menu item it has its own Properties that you can change. To change property click on the New menu item with the right key, then chose the option Properties.

How to add Menus to Windows Forms C# Tutorials


With the New item selected, have a look at the Properties Window on the right hand side of Visual Studio and change property for New item.

How to add Menus to Windows Forms C# Tutorials


In the same way add  another items on your File Menu and change property until your form looks like the screenshot below:

How to add Menus to Windows Forms C# Tutorials

But in this Menu we have a dividing line. To create a dividing line, click inside of the “Type Here” area below Save as. Now type a hyphen (just to right of the zero key on keyboard). When you press the Enter, C# will turn the hyphen into a dividing line.


If you need any help feel free to leave a comment (or) contact me.

No comments:

Post a Comment