# Dialog.Open(Text [, var Any,...]) Method
> Version: _Available or changed with runtime version 1.0._
Opens a dialog window.
## Syntax
```al
 Dialog.Open(String: Text [, var Variable1: Any,...])
```
> NOTE
> This method can be invoked without specifying the data type name.
## Parameters
Dialog
Type: dialog-data-type
An instance of the dialog-data-type data type.
String
Type: ../text/text-data-type
This string contains the text that you want to display in the window. Use a backslash (\\) to start a new line. Use number signs (#) to insert variable values into the string. Place the number signs where you want to substitute the variable value. Place a number in the part of the string where a variable value will be substituted (for example, #1####) to be able to reference this field for updating. The number of # characters in the string indicates the length of the field. You can update the fields using the UPDATE method (Dialog) or by letting the user edit the values.
*[Optional] Variable1*
Type: ../any/any-data-type
Use these optional parameters to specify variables for field1, field2, and so on in the String.
## Remarks
> NOTE
> The use of a backslash (`\`) to initiate a new line is not applicable to progress dialogs that are displayed during the Generation or Regeneration process of a PromptDialog page. See ../../devenv-page-type-promptdialog.
Dialog windows that are opened by an object are closed when the object terminates.
Dialog windows are automatically sized to hold the longest line of text and the total number of lines.
We recommend the following guidelines:
 Enter messages as text constants.
 Write messages using active voice. For example, write "Processing items" instead of writing "Items are being processed."
 Align the \# field to the left with at least one space character between the text and the variable.
> NOTE
> With the Dynamics NAV Client connected to Business Central, you can use @ characters instead of # characters for the String parameter to display the value as percentage and a progress indicator. The percentage value that is displayed is the percentage of the variable value from 0 to 9999. This is not supported in the Business Central Web client.
## Example 1
This example shows how to use the dialog.Open method.
```al
var
    MyDialog: Dialog;
    MyNext: Integer;
    Text000: Label 'Counting to 4 #1:';
begin
    MyNext := 0;
    MyDialog.Open(Text000,MyNext);
    repeat
      // Do some processing.
      Sleep(1000);
      MyNext := MyNext + 1;
      MyDialog.Update(); // Update the field in the dialog.
    until MyNext = 4;
    Sleep(1000);
    MyDialog.Close();
end;
```
The dialog window opens and displays this text:
Counting to 4: 0
Every one second, the dialog window updates with the new value of MyNext until it reaches 4, then the dialog window closes.
## Example 2
This example shows how to use the dialog.Open method to display a progress indicator in the Dynamics NAV Client connected to Business Central. The progress indicator will not display in the Business Central Web client.
```al
var
    MyDialog: Dialog;
    MyNext: Integer;
    Text000: Label 'Progress from 0 to 9999 #1#####';
begin
    MyNext := 0;
    MyDialog.Open(Text000,MyNext);
    repeat
      // Do some processing.
      MyNext := MyNext + 1;
      MyDialog.Update(); // Update the field in the dialog.
    until MyNext = 9999;
    Sleep(1000);
    MyDialog.Close();
end;
```
The dialog window opens and displays the progress indicator and percentage.
## Related information
dialog-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/dialog/dialog-open-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/dialog/dialog-open-method/
