MsgBox(msg As String, buttons As Integer) As Integer

 

Displays message box showing the message msg passed.

 

buttons enables you to customize the buttons and icon displayed in the message box to a limited extent. You get a fixed choice of button text and button positions. The value of Buttons is the sum of values that describe the number and labelling of the buttons, the icon, and the default button.There are three groups of button values; each group offers choices for a particular feature

 

Parameters:

 

Name

Type

Description

msg

String

Message to be displayed by message box

buttons

Integer

The value of buttons is the sum of values that describe the number and labelling of the buttons, the icon, and the default button.There are three groups of button values; each group offers choices for a particular feature.

 

Example: If you want the buttons to be the "Abort, Retry, and Ignore" set, with a Caution icon, and Retry as the default, you would add up 2 + 48 + 256 = 306.

 

Group 1 : Number and Type of Buttons

Value

Description

0

Display OK button only.

1

Display OK and Cancel buttons.

2

Display Abort, Retry, and Ignore buttons.

3

Display Yes, No, and Cancel buttons.

4

Display Yes and No buttons only.

5

Display Retry and Cancel buttons

 

Group 2 : Icon to be Displayed

Value

Description

0

No icon.

16

Stop sign icon.

32

Question icon.

48

Caution triangle icon.

64

Note Icon.

 

Group 3 : Selection of Default Button

Value

Description

0

First button of Group 1 list is the default.

256

Second button of Group 1 list is the default.

512

Third button of Group 1 list is the default.

768

No button is the default.

 

Returns:

 

Type

Value

Description

String

Integer

Returned value indicates which button was clicked.

 

Value

Button pressed

1

OK

2

Cancel

3

Abort

4

Retry

5

Ignore

6

Yes

7

No

 

 

Hint:

If you don't use the optional parameters,

MsgBox can be called without handling result.

 

 

Available in:

 

WindowMain

WindowLink

YES

YES

 

 Used in:

 

XojoScript Name

GUID

Import ISR payment file

52C27AC4-24B7-4B7D-9107-6223B4E10E45

 

Hint: You can find more references to XojoScripts which make use of this function by sending the following SQL statement to the database:

Select id,GUID, ScriptName,ScriptCode from im_scripts where ScriptCode Like '%MsgBox%'

 

Example XojoScript:

 

 Dim MsgResult As Integer

 

MsgResult = MsgBox("A Timeout occured!" + EOL + EOL + "Continue?",17)

 

If MsgResult = 2 Then

// Cancel Pressed

MsgBox("BYE!")

Return

Else

// Your code goes here

MsgBox("OK!")

End If