PasswordBox.Clear 方法

定义

清除 Password 属性的值。

public:
 void Clear();
public void Clear ();
member this.Clear : unit -> unit
Public Sub Clear ()

示例

以下示例演示如何使用 Clear 方法清除 PasswordBox

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

// Clear any contents of the PasswordBox, as well as the value stored in the Password property.
pwdBox.Clear();
Dim pwdBox As New PasswordBox()
pwdBox.Password = "Open Sesame!"

' Clear any contents of the PasswordBox, as well as the value stored in the Password property.
pwdBox.Clear()

注解

属性的值 Password 是在 Empty 调用此方法之后。

适用于