8.3. Display the Custom Dialog Box

To display a custom dialog box, you can use either of the following.

Dialog() function

Dialog statement.

Dialog() Function

You can use a Dialog() function to determine how the user closed your custom dialog box. For example, the following statement will return a value when the user clicks an OK button or a Cancel button or takes another action:

response% = Dialog(b)

The Dialog() function returns any of the following values:

Value returned

If a user clicks:


The OK button.


The Cancel button.


A push button.

The returned number represents which button was clicked based on its order in the dialog box template (1 is the first push button, 2 is the second push button, and so on).

Dialog Statement

You can use the Dialog statement when you don't need to determine how the user closed your dialog box. You'll still be able to retrieve other information from the dialog box record, such as the value of a list box or other dialog box control.

An example of the correct use of the Dialog statement is:

Dialog mydlg


Dialog is the statement that calls a declared dialog name.

mydlg is the dialog name in this example.

More information

8. Use a custom dialog box in a script.