By Kardi Teknomo, PhD.


< Previous | Next | VB Tutorial | Contents >

VB Menu

In this section, you will learn how to create menu in VB6:

  1. Continue the MDI Form project, in the Project Window, double click the MDI Form1 to put the MDI Form in front
  2. In the Menu of VB, click Tools > Menu Editor or you can use Ctrl-E. The menu Editor will appear.menu
  3. In the Caption, type &File then in the name, type mnuFile then click Next button
  4. In the Caption, type &Exit then in the name, type mnuExit then click right arrow button. In the Shortcut list, choose Ctrl-X, then Next button
  5. In the Caption, type &Window then in the name, type mnuWindow then click the Window List checkbox, and then the Next button.
  6. In the Caption, type &Calendar then in the name, type mnuCalendar then click right arrow button. In the Shortcut list, choose Ctrl-L, then Next button
  7. In the Caption, type &Controller then in the name, type mnuController then click right arrow button. In the Shortcut list, choose F6, then Next button
  8. The menu editor will be the same as figure on the right. Press OK
  9. Now you have menu in the MDI Form, click File>Exit and enter
  10. In the mnuExit_Click procedure, type
Private Sub mnuExit_Click()
End
End Sub
  1. In the menu of MDI form, select Window > Controller and click to wrie the subsequent code

Private Sub mnuController_Click()
If mnuController.Checked = True Then
'now is checked, make it unchecked
frmController.Hide
mnuController.Checked = False
Else ' now is unchecked, make it checked
frmController.Show
mnuController.Checked = True
End If
End Sub
  1. Run the program, and look at the Window menu and try the Exit menu.

< Previous | Next | VB Tutorial | Contents >

 

Rate this tutorial or give your comments about this tutorial

 

This tutorial is copyrighted.

Preferable reference for this tutorial is

Teknomo, Kardi. Visual Basic Tutorial . https:\\people.revoledu.com\kardi\ tutorial\VB