Uredi

Deli z drugimi prek


PasswordBox.Password Property

Definition

Gets or sets the password currently held by the PasswordBox.

public:
 property System::String ^ Password { System::String ^ get(); void set(System::String ^ value); };
public string Password { [System.Security.SecurityCritical] get; [System.Security.SecurityCritical] set; }
public string Password { get; set; }
[<get: System.Security.SecurityCritical>]
[<set: System.Security.SecurityCritical>]
member this.Password : string with get, set
member this.Password : string with get, set
Public Property Password As String

Property Value

A string representing the password currently held by the PasswordBox.

The default value is Empty.

Attributes

Examples

The following example shows how to set the Password property programmatically.

PasswordBox pwdBox = new PasswordBox();
pwdBox.Password = "Open Sesame!";
Dim pwdBox As New PasswordBox()
pwdBox.Password = "Open Sesame!"

Remarks

When you get the Password property value, you expose the password as plain text in memory. To avoid this potential security risk, use the SecurePassword property to get the password as a SecureString.

Setting this property to null causes the underlying password to be set to Empty.

Applies to

See also