Table of Contents

Class CredentialDialog

Namespace
System.Windows.Forms
Assembly
NetEx.WinForms.CredentialDialog.dll

Displays a standard dialog box that prompts the user to enter credentials. This class cannot be inherited.

[ToolboxBitmap(typeof(CredentialDialog), "ToolboxBitmap.png")]
public sealed class CredentialDialog : CommonDialog, IComponent, IDisposable
Inheritance
CredentialDialog
Implements
Inherited Members

Constructors

CredentialDialog()

Initializes a new instance of the CredentialDialog class.

public CredentialDialog()

Properties

AuthenticationError

Gets or sets a value indicating a Windows error code to be displayed in the dialog box. This only applies to Windows Vista or later, and only when AutoUpgradeEnabled is set to true.

public int AuthenticationError { get; set; }

Property Value

int

The Windows error code for the corresponding error message to be formatted and displayed in the dialog box.

AutoUpgradeEnabled

Gets or sets a value indicating whether the dialog box should automatically upgrade appearance and behavior when running on Windows Vista or later.

public bool AutoUpgradeEnabled { get; set; }

Property Value

bool

true if the dialog box should automatically upgrade appearance and behavior when running on Windows Vista or later; otherwise, false. The default is true.

Remarks

If this property is false the dialog box will have a Windows XP-style appearance and behavior on Windows Vista. On Windows XP and Windows Server 2003 this property does not have any effect.

CredentialFilter

Gets or sets a value indicating the types of credentials that will be shown in the dialog box when running on Windows XP and Windows Server 2003, or when AutoUpgradeEnabled is set to false.

public CredentialFilter CredentialFilter { get; set; }

Property Value

CredentialFilter

One of the CredentialFilter values. The default value is AllCredentials.

Remarks

This property is only applicable on Windows XP and Windows Server 2003, or on later versions of Windows when using the dialog box with AutoUpgradeEnabled set to false.

DisableUsername

Gets or sets a value indicating whether the dialog box should prevent the user from changing the supplied username when running on Windows XP and Windows Server 2003, or when AutoUpgradeEnabled is set to false.

public bool DisableUsername { get; set; }

Property Value

bool

true if the dialog box should prevent the user from changing the supplied username; otherwise, false. The default is true.

Remarks

This property is only applicable on Windows XP and Windows Server 2003, or on later versions of Windows when using the dialog box with AutoUpgradeEnabled set to false.

Domain

Gets or sets the domain entered in the dialog box.

public string Domain { get; set; }

Property Value

string

The domain entered in the dialog box. The default value is an empty string ("").

Exceptions

ArgumentException

value exceeds the maximum length for a domain.

Image

Gets or sets the image that is displayed in the dialog box when running on Windows XP and Windows Server 2003, or when AutoUpgradeEnabled is set to false.

public Image? Image { get; set; }

Property Value

Image

The Image to display.

Remarks

If this member is NULL, a default bitmap is used. The bitmap size is limited to 320x60 pixels.

This property is only applicable on Windows XP and Windows Server 2003, or on later versions of Windows when using the dialog box with AutoUpgradeEnabled set to false.

Exceptions

ArgumentException

value does not have the correct height or width.

IncorrectPasswordPrompt

Gets or sets a value indicating whether the dialog box should automatically notify the user of insufficient credentials by displaying the "Logon unsuccessful" balloon tip. This only applies when running on Windows XP and Windows Server 2003, or when AutoUpgradeEnabled is set to false.

public bool IncorrectPasswordPrompt { get; set; }

Property Value

bool

true if the dialog box should automatically notify the user of insufficient credentials by displaying the "Logon unsuccessful" balloon tip; otherwise, false. The default is false.

Remarks

This property is only applicable on Windows XP and Windows Server 2003, or on later versions of Windows when using the dialog box with AutoUpgradeEnabled set to false.

Message

Gets or sets the text to display in the dialog box.

public string Message { get; set; }

Property Value

string

The text to display in the dialog box. The default value is an empty string ("").

Exceptions

ArgumentException

value exceeds the maximum length for the message.

Password

Gets or sets a SecureString containing the password entered in the dialog box.

public SecureString? Password { get; set; }

Property Value

SecureString

The password entered in the dialog box. The default value is null.

Exceptions

ArgumentException

value exceeds the maximum length for a password.

SaveChecked

Gets or sets a value indicating whether the save check box is selected.

public bool SaveChecked { get; set; }

Property Value

bool

true if the save check box is selected; otherwise, false. The default value is false.

Remarks

The ShowSave property must be set before in order for the save check box to appear in the dialog box.

ShowSave

Gets or sets a value indicating whether the dialog box contains a save check box.

public bool ShowSave { get; set; }

Property Value

bool

true if the dialog box contains a save check box; otherwise, false. The default value is true.

Title

Gets or sets the dialog box title.

public string Title { get; set; }

Property Value

string

The dialog box title. The default value is an empty string ("").

Exceptions

ArgumentException

value exceeds the maximum length for the title.

Username

Gets or sets the username entered in the dialog box.

public string Username { get; set; }

Property Value

string

The username entered in the dialog box. The default value is an empty string ("").

Exceptions

ArgumentException

value exceeds the maximum length for a username.

Methods

Dispose(bool)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Reset()

Resets properties to their default values.

public override void Reset()

RunDialog(nint)

When overridden in a derived class, specifies a common dialog box.

protected override bool RunDialog(nint hwndOwner)

Parameters

hwndOwner nint

A value that represents the window handle of the owner window for the common dialog box.

Returns

bool

true if the dialog box was successfully run; otherwise, false.