Creation of the menu in visual basic, Visual Basic Programming

Creation of the Menu in VB

1. Initiate a new project by choosing a file and then new project.

2. Now select the Standard EXE as the Project type.

3. Build the Form1 active by clicking on it.

4. Pick the Tools and then Menu Editor to open the menu editor for designing.

5. Provide the caption as &display (i.e. display becomes the menu title)

6. Type a name. Suppose it be Mnudisp. This is a user defined.

7. To add the menu items click the next button in the menu editor.

8. Provide the caption as &square (i.e. square becomes the menu item)

9. Type a name. Suppose it be mnusquare. This is a user defined.

10. Relate a short cut key. The list box will pop up. Select a key. Say you have selected Ctrl + G. Then, to activate this menu item you require pressing CTRL and G keys altogether.

11. Put the checked property of the menu item square by clicking on the check box for the checked property.

12. Double click on the menu item. This takes you to the code window.

13. Type the given below code for the menu item square

Private Sub mnusquare_Click()

If (Form1.mnusquare.Checked) = False Then

Form1.mnusquare.Checked = True


Form1.mnusquare.Checked = False

End If

End Sub

14. Whenever you click on square menu item for the first time, the property Checked is set to TRUE. Therefore the else part executes and sets the property Checked to the FALSE. The control behaves as a toggle.

15. To address the controls on the form, then use the form name. The menu item we want to manipulate is mnusquare .And hence, to access the control we say Form1.mnusquare.Later we want to manipulate Checked property. Therefore we are qualifying it as the Form1.mnusquare.Checked

16. Select the Run option.

17. Select the Start With Full Compile.

18. The form will be displayed.

19. Click on the disp menu title

20. The sub menu pops up. You have square as the menu item. Note that the check mark is as shown in figure.

21. If you click on the menu item square then the check mark will disappear during the next execution.

22. Clicking once further time will bring the check mark.

972_menu editor.png

Figure: The Menu Editor

2219_menu item square.png

Figure: Menu Item Square

Posted Date: 10/9/2012 9:02:23 AM | Location : United States

Related Discussions:- Creation of the menu in visual basic, Assignment Help, Ask Question on Creation of the menu in visual basic, Get Answer, Expert's Help, Creation of the menu in visual basic Discussions

Write discussion on Creation of the menu in visual basic
Your posts are moderated
Related Questions
Question 1 Create a VB application to make the text bold, italic, underlined and also color the text (using checkbox, option button, textbox controls) Question 2 Create a

Write a program to print a digital clock which displays the time for 2 hours . ..

Depreciation to a Salvage Value of 0.   For tax purposes an item may be depreciated over a period of several years, n. With the straight-line method of depreciation, each year th

Do While Loop Statement : The statements contained by the do...while loop block executes till the condition given in the while is true. The working of do...loop is elaborate

I am a beginner in Visual basic 2012 and making a data management programme with visual basic 2012 as front end and MySql as back end. I want to filter data grid view table with Li

translate''Q''for insert into element and''Q''delete for deletion element into programming language

The objective of this unit is to describe the basics of VBScript. After completing this unit, you will be capable to write code for Web pages via VBScript. You will be able to unde

FILES IN A VB PROJECT The project file has the.vbp extension. The form in which we draw has the .frm extension; .mod denotes the module file; .cls denotes the class file; .res

I''m doing a project on vb.NET. I''m stuck with this place where I should replace the text to different characters from textbox1 to textbox2 without changing text in textbox1. For