PasswordBox.Password Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.