This documentation is archived and is not being maintained.

PasswordBox.Clear Method

Clears the value of the Password property.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)

public void Clear ()
public void Clear ()
public function Clear ()
You cannot use methods in XAML.

The value of the Password property is Empty after a call to this method.

The following example shows how to clear a PasswordBox with the Clear method.

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();

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: