ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

10-The Menu Strip

The MenuStrip control serves as the container for the menu structure. It works as the top-level container for the menu structure. It is composed of ToolStripMenuItem class and the ToolStripDropDownMenu class that provide the functionalities such as create menu items, sub menus and drop-down menus.

 

Example for adding MenuStrip.

 

In the toolbox select menustrip control and drag it into the form.

mStrip0

Click the MenuStrip control and add the following menus such as File, View and help.

mStrip1

Click the File menu and add the following submenus such as New and Close.

mStrip2

 

See the example below for adding function in the MenuStrip control.

 

Click the File menu and double click the Close submenu to fire the event handler of ToolStripMenuItem .

mStrip3

Add the following code in the CloseToolStripMenuItem click event handler .

  1. me.close()

The code in the view code will look like this.

  1. Public Class Form1
  2.  
  3. Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseToolStripMenuItem.Click
  4. Me.Close()
  5. End Sub
  6. End Class

 

Facebook Comments

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!