"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
|
|
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
|
|