MsgBoxEx

<< Click to Display Table of Contents >>

 

MsgBoxEx

MsgBoxEx(prompt, [buttons], [title], [PosX], [PosY])

This method allows displaying a default Windows dialog box and specify its position on the screen. The available parameters in this method are the following:

prompt: Text to display on the dialog box. The maximum size of this text is approximately 1024 characters, depending on the width of the characters used. To insert line breaks on this text, separate these lines using VBScript's Chr function with values 10 (linefeed), 13 (carriage return), or a combination of these values between each line

buttons: An optional numerical expression that represents the sum of values specifying the number and type of buttons displayed, style, default button, and whether this dialog box is modal or not. The default value of this parameter is 0 (zero), that is, only displays the OK button. Please check the next table for more information about this parameter

title: An optional text displayed on the title bar of this dialog box. If this parameter is omitted, this dialog box does not show any title

PosX: Indicates the position, in pixels, of this dialog box relative to the window's left margin. If this parameter is omitted, the respective dialog box's coordinate is centered on the window

PosY: Indicates the position, in pixels, of this dialog box relative to the window's top margin. If this parameter is omitted, the respective dialog box's coordinate is centered on the window

 

NOTE

If the values indicated in the PosX and PosY parameters place this dialog box outside the visible area, those values are automatically adjusted to ensure this dialog box is visible.

 

Possible values for the buttons parameter are described on the next tables.

Possible values for types of buttons

Value

Description

Constant in VBScript

0

Displays only the OK button

vbOKOnly

1

Displays the OK and Cancel buttons

vbOKCancel

2

Displays the Abort, Retry, and Ignore buttons

vbAbortRetryIgnore

3

Displays the Yes, No, and Cancel buttons

vbYesNoCancel

4

Displays the Yes and No buttons

vbYesNo

5

Displays the Retry and Cancel buttons

vbRetryCancel

 

Possible values for icon styles

Value

Description

Constant in VBScript

16

Displays an icon indicating a critical message

vbCritical

32

Displays an icon indicating a question

vbQuestion

48

Displays an icon indicating a statement

vbExclamation

64

Displays an icon indicating an information

vbInformation

 

Possible values for default buttons

Value

Description

Constant in VBScript

0

Indicates that the first button is the default return

vbDefaultButton1

256

Indicates that the second button is the default return

vbDefaultButton2

512

Indicates that the third button is the default return

vbDefaultButton3

768

Indicates that the fourth button is the default return

vbDefaultButton4

 

Possible values for types of modal windows

Value

Description

Constant in VBScript

0

Indicates that users must respond this dialog box before continuing work on the application

vbApplicationModal

4096

Indicates that all applications are suspended until users respond this dialog box

vbSystemModal

 

This method returns a number representing the button clicked on the dialog box, according to the next table.

Return values of the MsgBoxEx method

Value

Button

Constant in VBScript

1

OK

vbOK

2

Cancel

vbCancel

3

Abort

vbAbort

4

Retry

vbRetry

5

Ignore

vbIgnore

6

Yes

vbYes

7

No

vbNo

Was this page useful?