Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Module: Menus in Category Microsoft Visual Basic 6 : Menus from Total Visual SourceBook

Visual Basic 6 (VB6) menu routines

Procedure List

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the modMenus module
AddBitmapToMenu Procedure Set the 'checked' and 'unchecked' bitmaps to be used with a form's menus
SetEditMenuItemStates Procedure Tests a control (text box or rtf control) to set the Enabled property of an Edit menu's Cut, Copy, Paste, and Undo buttons appropriately. Call this function from the OnClick event of the top-level Edit menu. Normally this top-level menu item does not have any code associated with it. By placing this code here, it is possible to set the states of the Edit sub-menu items before they become visible after clicking on the Edit menu item.

Example Code for Using Module: Menus

' Example of modMenus
'
' To try this example, do the following from Visual Basic 6:
' 1. Create a new form
' 2. Add a text box called 'txtTest'
' 3. Create the menu structure consisting of a top-level menu called 'mnuEdit'
' 4. Underneath this menu, create menu items called 'mnuEditCut', 'mnuEditCopy', 'mnuEditPaste' and 'mnuEditUndo'
' 5. Create another top-level menu item called 'mnuCustom'
' 6. Underneath this menu, create menu items called 'mnuCustomItem1', and 'mnuCustomItem2'
' 7. The complete menu structure should look something like this in the VB6 Tools, Menu Editor Dialog:
'
'    Caption         Menu Control Name
'    -----------------------------------
'    &Edit           mnuEdit
'    ....Cut         mnuEditCut
'    ....Copy        mnuEditCopy
'    ....Paste       mnuEditPaste
'    ....Undo        mnuEditUndo
'    Custom mnuCustom
'    ....Item 1      mnuCustomItem1
'    ....Item 2      mnuCustomItem2
' 8. Add an image control named 'imgChecked' to the form. It may be invisible
' 9. Add an image control named 'imgUnchecked' to the form. It may be invisible
' 10. Paste all the code from this example to the new form's module.

' This example assumes that the sample files are located in the folder named by the following constant.
Private Const mcstrSamplePath As String = "C:\Total Visual SourceBook 2013\Samples\"

Private Sub Form_Load()
  imgChecked.Picture = LoadPicture(mcstrSamplePath & "Checked.bmp")
  imgUnchecked.Picture = LoadPicture(mcstrSamplePath & "Unchecked.bmp")

  ' Example of AddBitmapToMenu
  '
  'Set pictures for first subitem on second main menu
  AddBitmapToMenu Me.hWnd, CLng(imgUnchecked.Picture), CLng(imgChecked.Picture), 1, 0

  'Set pictures for second subitem on second main menu
  AddBitmapToMenu Me.hWnd, CLng(imgUnchecked.Picture), CLng(imgChecked.Picture), 1, 1

End Sub

Private Sub mnuCustomItem1_Click()
  mnuCustomItem1.Checked = Not mnuCustomItem1.Checked
End Sub

Private Sub mnuCustomItem2_Click()
  mnuCustomitem2.Checked = Not mnuCustomitem2.Checked
End Sub

Private Sub mnuEdit_Click()
  ' Example of SetEditMenuItemStates
  SetEditMenuItemStates txtTest, mnuEditCut, mnuEditCopy, mnuEditPaste, mnuEditUndo

End Sub

Microsoft Access Module LibraryOverview of Total Visual SourceBook

The source code in Total Visual SourceBook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Additional Resources