Home and Learn: VB Net Course

A VB .NET Menu Project

This tutorial assumes that you have been following along from the first one

Add the following Main Menu items to the menu bar you have already designed in this section:

  1. Edit
  2. View

On your Edit Menu, place the following menu items:

  1. Undo
  2. Cut
  3. Copy
  4. Paste

On your View Menu, place the following menu items:

  1. View Textboxes
  2. View Labels
  3. View Image

Just like you did with the Exit menu item, Change the Name property of ALL menu items. Do not leave them on the defaults of "MenuItem1", "MenuItem2", etc. (You should change the Name property to something relevant, and use the prefix mnu. For example, the Undo item could have the Name mnuUndo.)

  1. Add an underline shortcut for ALL menu item
  2. Add a least one key combination shortcuts per drop down menu (you already have one on the File menu, so this doesn't count)

When you have finished, your menus should look like these (though you can use different key combinations, if you like):

Edit Menu

The Edit Menu

View Menu

The View Menu

  1. Write code to display a message box whenever a menu item is clicked, or its shortcut used. The message box should explain what the menu item will do when it's fully implemented.

There's only one line of code to write for each menu item. You can get at the code for the click event of each menu item in exactly the same way that you did for the Exit menu item.

Good Luck!

In the next part, you'll learn how to write code for all your new menu items. We start with the Open menu item.

Back to the VB NET Contents Page


Buy the Book of this Course

Email us: enquiry at homeandlearn.co.uk