<< Click to Display Table of Contents >>

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


Alternative to the original VBScript MsgBox method.


Displays a prompt in a dialog box, waits for the user to input text or click a button, and returns the contents of the text box. 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 also the DL.SetUserOutput function on how to create an additional user output area and display extra user information.


Return Value






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





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.


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.


Optional. String expression displayed in the text box as the default response if no other input is provided. If you omit default, the text box is displayed empty.


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"


 DL.AddComment "Canceled"

End If