Jump: Search:

Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access 2007/2010 Version
is Shipping!

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

Supports Access/Office 2010 (32 bit), 2007, 2003, 2002, 2000, and
Visual Basic 6.0!

Also available 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

 

 

 

 

 
Royalty free source code library modules for Microsoft Access, VB6, VBA, OfficeRoyalty free source code library modules for Microsoft Access, VB6, VBA, OfficeVBA and VB6 Source Code Library Download the free trial version of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA
Category: General VBA/VB6 : Application Techniques
Description: Common application development code for messages boxes, error handling, and shutting down windows

Class: CMsgBox

Wrapper class to simplify using Message Boxes.

Coding MsgBox statement throughout your application can be a drudge. You have to specify all the parameters for your message box as parameters, and add a bunch of bits together to specify attributes. This class solves that problem by providing a very simple wrapper over the MsgBox command that exposed the message box as a set of properties and actions.

Procedure Name

Type

Description

(Declarations) Declarations Declarations and private variables for the CMsgBox class
Buttons Property Gets the buttons shown on the message box. The following values are available: - btnOKOnly: show the OK button only. - btnOKCancel: show OK and Cancel buttons. - btnOKAbortRetryIgnore: show OK, Abort, Retry and Ignore buttons. - btnYesNoCancel: show Yes, No and Cancel buttons. - btnYesNo: show Yes and Not buttons. - btnRetryCancel: show Retry and Cancel buttons. If you specify a value for the HelpFile property, the message box displays a Help button in addition to the buttons you have defined with the Buttons property.
DefaultButton Property Gets the current Default button setting for the message box. The following values are available: - dfButton1: First button is default. - dfButton2: Second button is default. - dfButton3: Third button is default. - dfButton4: Fourth button is default.
Foreground Property Returns whether the messge box is set to appear in the foreground (top-most window)
HelpContextID Property Gets the current help context ID. If you specify a value for this property, you must also specify a the path and name of a help file using the HelpFile property.
HelpFile Property Gets the help file currently used by the message box. If you specify a value for this property, the message box displays a Help button in addition to the buttons you have defined with the Buttons property.
Icon Property Gets the current icon used for the message box. The following values are available: - icoCritcal - Critical stop icon - icoQuestion - Question icon - icoExclamation - Exclamation icon - icoInformation - Information icon
Message Property Gets the message text for the message box. As with the VB MsgBox command, the string passed to the Message property can contain carriage-return/line-feed characters so the text contains blanks lines for readability. Use the VBCRLF constant to get these.
Modal Property Gets the current modal mode for the message box. Use the Modal property to specify the modality of the message box: - mbNotModal: Message box is not modal. - mbApplicationModal: Message box is modal to the application that called it. - mbSystemModal: Message box is modal to all windows. The user must respond to the message box before any other windows can get focus. Note that this option is not applicable in Windows NT and Windows 95 and later. It is included for backwards compatibility with Windows 3.x.
Response Property Gets the user's response to the message box. When the user responds to the message box by pressing one of the buttons, this property is set to a value that represents the buttons pressed. The return values are defined by the EnumMBResponse enumerated type, and corresponds exactly to the VB MsgBox return value constants. Because of this, you can use either the class enumerated type, or the VB MsgBox return value constants: Dim MyMsg As CMsgBox MyMsg.Buttons = btnOKCancel MyMsg.Message = "This is a test." ' Show the message box MyMsg.Show ' The following two statements are the same If MyMsg.Response = mbReturnOK Then Debug.Print "OK" End If If MyMsg.Response = vbOK Then Debug.Print "OK" End If
RightAligned Property Gets the current RightAligned property for the message box. This property corresponds to the VB vbMsgBoxRight property which appears to have no effect on Windows 95/98 systems. This property works only under Windows NT.
Title Property Sets the title for the message box The title bar of a message box usually contains your application name, or text summarizing the reason for the message. VB expands the message box window to accommodate the length of your title text, so you should keep the value for this property short. Otherwise, you can end up with a message box window as wide as the screen.
Show Method Shows the message box with the properties and settings that you have already specified

Overview 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

Feedback

Contact Us  l   Web questions: Webmaster   l   Copyright © FMS, Inc., Vienna, Virginia
Celebrating our 26th Year of Software Excellence