CommonDialog.ShowDialog Method

Definition

Displays a common dialog.

Overloads

ShowDialog()

Displays a common dialog.

ShowDialog(Window)

Displays a common dialog.

Remarks

ShowDialog performs initialization tasks for all common dialogs before calling RunDialog. Since RunDialog requires an owner window, ShowDialog attempts to assign one in the following order of precedence:

  • The current application's active window.

  • The current application's parking window.

  • An internally generated hidden window.

ShowDialog()

Displays a common dialog.

public:
 virtual Nullable<bool> ShowDialog();
[System.Security.SecurityCritical]
public virtual bool? ShowDialog ();
public virtual bool? ShowDialog ();
[<System.Security.SecurityCritical>]
abstract member ShowDialog : unit -> Nullable<bool>
override this.ShowDialog : unit -> Nullable<bool>
abstract member ShowDialog : unit -> Nullable<bool>
override this.ShowDialog : unit -> Nullable<bool>
Public Overridable Function ShowDialog () As Nullable(Of Boolean)

Returns

Nullable<Boolean>

If the user clicks the OK button of the dialog that is displayed (e.g. OpenFileDialog, SaveFileDialog), true is returned; otherwise, false.

Attributes

Remarks

ShowDialog performs initialization tasks for all common dialogs before calling RunDialog.

In the current implementation, the derived classes (OpenFileDialog and SaveFileDialog) will only return true or false.

Applies to

ShowDialog(Window)

Displays a common dialog.

public:
 Nullable<bool> ShowDialog(System::Windows::Window ^ owner);
[System.Security.SecurityCritical]
public bool? ShowDialog (System.Windows.Window owner);
public bool? ShowDialog (System.Windows.Window owner);
[<System.Security.SecurityCritical>]
member this.ShowDialog : System.Windows.Window -> Nullable<bool>
member this.ShowDialog : System.Windows.Window -> Nullable<bool>
Public Function ShowDialog (owner As Window) As Nullable(Of Boolean)

Parameters

owner
Window

Handle to the window that owns the dialog.

Returns

Nullable<Boolean>

If the user clicks the OK button of the dialog that is displayed (e.g. OpenFileDialog, SaveFileDialog), true is returned; otherwise, false.

Attributes

Remarks

ShowDialog performs initialization tasks for all common dialogs before calling RunDialog. Additionally, the dialog that is eventually shown is assigned an owner window, which is specified by the owner parameter.

In the current implementation, the derived classes (OpenFileDialog and SaveFileDialog) will only return true or false.

See also

Applies to