windowsforms-devexpress-dot-xtraeditors-dot-xtraform-dot-showdialog-x28-system-dot-windows-dot-forms-dot-iwin32window-x29.md
Shows the form as a modal dialog box with the specified owner.
Namespace : DevExpress.XtraEditors
Assembly : DevExpress.Utils.v25.2.dll
NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core
public DialogResult ShowDialog(
IWin32Window owner
)
Public Function ShowDialog(
owner As IWin32Window
) As DialogResult
| Name | Type | Description |
|---|---|---|
| owner | IWin32Window |
Any object implementing IWin32Window that represents the top-level window that will own the modal dialog box.
|
| Type | Description |
|---|---|
| DialogResult |
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.
Note
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.
}
myModalForm.Dispose();
}
Private Sub ShowMyModalForm()
Dim myModalForm As DevExpress.XtraEditors.XtraForm = New MyModalForm()
Dim dialogResult As DialogResult
dialogResult = myModalForm.ShowDialog(Me)
If dialogResult = System.Windows.Forms.DialogResult.OK Then
' Perform required actions here if the dialog result is Ok.
Else
' Perform default actions here.
End If
myModalForm.Dispose()
End Sub
The following code snippets (auto-collected from DevExpress Examples) contain references to the ShowDialog(IWin32Window) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
DialogResult result = dlg.ShowDialog(this);
dlg.Dispose();
DialogResult result = dlg.ShowDialog(this);
dlg.Dispose();
how-to-export-cell-range-to-a-datatable/CS/ExportToDataTableExample/Form1.cs#L203
newForm.ShowDialog(this);
return newForm;
reporting-crosstab-customization/CS/CrosstabControlCustomizationExample/Form1.cs#L38
}
form.ShowDialog(this);
reporting-winforms-custom-report-storage/CS/Form1.cs#L21
form.OpenReport(url);
form.ShowDialog(this);
Dim result As DialogResult = dlg.ShowDialog(Me)
dlg.Dispose()
Dim result As DialogResult = dlg.ShowDialog(Me)
dlg.Dispose()
how-to-export-cell-range-to-a-datatable/VB/ExportToDataTableExample/Form1.vb#L188
CType(grid.FocusedView, DevExpress.XtraGrid.Views.Grid.GridView).OptionsView.ShowGroupPanel = False
newForm.ShowDialog(Me)
Return newForm
reporting-crosstab-customization/VB/CrossTabControlCustomizationExample/Form1.vb#L38
End If
form.ShowDialog(Me)
reporting-winforms-custom-report-storage/VB/Form1.vb#L24
End If
form.ShowDialog(Me)
See Also