Skip to main content

XtraForm.ShowDialog(IWin32Window) Method

Shows the form as a modal dialog box with the specified owner.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.Utils.v23.1.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core


public DialogResult ShowDialog(
    IWin32Window owner


Name Type Description
owner IWin32Window

Any object implementing IWin32Window that represents the top-level window that will own the modal dialog box.


Type Description

One of the DialogResult values.


Use this method to show a modal dialog window in your application. The owner parameter specifies the form that owns the modal dialog window being shown.

When the modal dialog window is closed, the ShowDialog method returns one of the DialogResult values. To specify the dialog result to be returned when the modal form is closed, use the form’s DialogResult property, or the BaseButton.DialogResult property of a button on the form.


Since modal windows are not automatically disposed, you must call the Dispose method manually if the modal window is no longer needed.

The code snippet below illustrates how to display a modal form for a given owner form, and read the dialog result.

private void ShowMyModalForm() {
    DevExpress.XtraEditors.XtraForm myModalForm = new MyModalForm();
    DialogResult dialogResult;
    dialogResult = myModalForm.ShowDialog(this);
    if (dialogResult == System.Windows.Forms.DialogResult.OK) {
        // Perform required actions here if the dialog result is Ok.
    else {
        // Perform default actions here.
See Also