SpeakComputers.com
Home
Software
Electronics
Desktop Computers
Laptops
Games
Handheld Devices
Mobile Phones
Cameras
Camcorders
Printers
Books
Software Downloads 2012 Software Mac Software Security Student Editions Windows 7 Office 2010
ASP.NET C# VB.NET C++ .NET Infragistics DevComponents

VB.NET MenuStrip Control.

The VB.NET Windows MenuStrip control provides an application menu system. The menustrip works with both Single document interfaces SDI and Multiple document interfaces MDI. With MDI applications the MenuStrip can be configured to merge with the main form for better navigation.

Namespace: System::Windows::Forms
System.Windows.Forms (in system.windows.forms.dll)

Creating an new VB.NET Windows forms MenuStrip.
Dim menustrip As New MenuStrip

Assigning a new location for the VB.NET Windows Forms MenuStrip.
menustrip.Location = New Point(0, 0)

Assigning a size value to the VB.NET MenuStrip.
menustrip.Size = New Size(Me.Width, 24)

Now we need to add menuitems to the menustrip control. The items I am speaking about are the dropdown menus, File, Edit, Windows etc, and the clickable button items within the menus, Open, Save, SaveAS etc.

Adding the first menu item - MenuStripItem.
Dim menuitem1 As New ToolStripMenuItem

Assigning a text value to the MenuStripItem
menuitem1.Text = "File"

Adding an image to the MenuStripItem.
menuitem1.Image = Image.FromFile("e:\file.png")

Now we add the first MenuStripItem to the MenuStrip itself.
menustrip.Items.Add(menuitem1)

Next we are going to add a second MenuStripItem but we are going to add it to the first MenuStripItem as a dropdown item.
Dim menuitem2 As New ToolStripMenuItem
menuitem2.Text = "Exit"

Adding menuitem2 as a DropDown Menu item.
menuitem1.DropDownItems.Add(menuitem2)

Adding a VB.NET MenuStrip control to the form.
Me.Controls.Add(menustrip)

Assign the MainMenuStrip to the form.
Me.MainMenuStrip = menustrip

Creating a Click Event for the VB.NET MenuStripItem control.
AddHandler menuitem2.Click, AddressOf menuitem2_click

Responding to the VB.NET MenuStripItem Click event.
Private Sub menuitem2_click(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("Menuitem Clicked")
End Sub

VB.NET MenuStrip control Tutorial.
Computer Security
AntiVirus Software
Internet Security
Parental Controls
Backup & Recovery
Computer Protection
Anti Malware
Photo & Video
Photo & Video Editing
Video Music
Desktop Publishing
Professional Design
Home Publishing
Clipart
Business & Accounting
Accounting
Payroll
Check Printing
TAX
H&R Block
Microsoft Office
Design
Graphic Design
Home Design
Garden Design
Interior Design
Computer Aided Design
3D Design
Students & Teacher
Adobe
Microsoft Office
Dragon Naturally Speaking
Corel Draw
Serif
Student/Teacher Software
Copy Right 2006 SpeakComputers.com - All Rights Reserved.
Home About Privacy Policy Resouces