Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
SQL Server

How we can Utilize Menus and Menu Items Component in Easy Way Using VB.Net

Author: DevASP
Download Source Code :

In this article I Will Explain How we Use Menu Coponents in simplest way and How we can use Form’s Instance for calling Its Builtin Methods

Creating the menu system during design time is very easy in Visual Basic .NET thanks to the Main Menu component. This critical component manages a collection of Menu Item Controls, which work together to form the menu interface within an application.


To use the Main Menu component to create Menu Items, follow these steps:


1. Double-click the Main Menu component in the Toolbox to add a Main Menu Component to the component tray within the Windows Form Designer. The menu system appears in the form, with Type Here highlighting the area you can use to add the first Menu Item.


2. Enter text for the first menu item


3. As you add Menu Items in the designer, notice that additional Menu Item Locations appear, you can build the entire menu structure in this manner.


4. Use the Properties window to set the individual properties of the Menu Items you  have created.


Now Double Click On Your Menu Item You Will See That In Code File The Auto Generated Function Appears. Now You can use that Function in your own way..For the better understanding I use that functions for calling new form or close the any form .


For Form calling we make the instance of that forms name space and then call the show method. And for Closing any form we just use Me and call its method dispose which infact use for close form. We can use Any where Me for doing Any thing with the active form itself.


Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click


        Dim frm2 As New Form2



End Sub


Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click




End Sub


Shortcut Keys


While typing the name of menu just enter the & Sign Before the letter you want to access as Shortcut key. Shortcut key is accessed by ALT + LETTER. The source Code is given by this article for your Complete Understanding. Just Run it You Can understand Menu Functionality And Its Builtin Routines.

Add Article Comment:
Name :
Email Address :
Comments :
<< How we can Create Animated Application Using VB.Net.

Disclaimer - Privacy
© 2002-2017