MsgBox2

<< Click to Display Table of Contents >>

Navigation:  Reference (Scripting) > Docklight Script Commands - The DL Object > Methods (Advanced) >

MsgBox2

Alternative to the original VBScript MsgBox method.

 

Displays a message box, waits for the user to click a button, and returns a value that indicates which button the user clicked. This dialog will always appear on the same screen as the Docklight Scripting main window. It does not support the optional arguments helpfile and context of the VBScript MsgBox method.

 

TIP: As an alternative, see the DL.SetUserOutput function on how to create an additional user output area and show extra user information.

 

Return Value

 

Integer

 

Syntax

 

result = DL.MsgBox2 (prompt[, buttons][, title])

 

Part

Description

prompt

Required.  String expression displayed as the message in the dialog box. The maximum length of prompt is approximately 1024 characters, depending on the width of the characters used. If prompt consists of more than one line, you can separate the lines using a carriage return character (Chr(13)), a linefeed character (Chr(10)), or carriage return plus linefeed character combination (Chr(13) & Chr(10)) between each line.

buttons

Optional, common values are a combination (sum) of the below constants:

 

Constant                Value        Description

vbOKOnly                0        OK button only (default)

vbOKCancel                1        OK and Cancel buttons

vbAbortRetryIgnore        2        Abort, Retry, and Ignore buttons

vbYesNoCancel        3        Yes, No, and Cancel buttons

vbYesNo                4        Yes and No buttons

vbRetryCancel                5        Retry and Cancel buttons

vbCritical                16        Critical message

vbQuestion                32        Warning query

vbExclamation                48        Warning message

vbInformation                64        Information message

vbDefaultButton1        0        First button is default (default)

vbDefaultButton2        256        Second button is default

vbDefaultButton3        512        Third button is default

 

TIP: For a full list of all constants available, see the Microsoft VBA documentation for MsgBox.

title

Optional. String expression displayed in the title bar of the dialog box. If you omit title, the application name is placed in the title bar.

result

Returns the user action:

 

Constant        Value        Description

vbOK                1        OK button pressed

vbCancel        2        Cancel button pressed

vbAbort        3        Abort button pressed

vbRetry        4        Retry button pressed

vbIgnore        5        Ignore button pressed

vbYes                6        Yes button pressed

vbNo                7        No button pressed

 

'Example MsgBox2 Function

result = DL.MsgBox2("Run this test?", 3, "My Title")

If result = 6 Then 

 DL.AddComment "Yes button pressed"

ElseIf result = 7 Then 

 DL.AddComment "No button pressed"

Else

 DL.AddComment "Canceled"

End If