CoreSuite.PasswordBox 2.0.0

dotnet add package CoreSuite.PasswordBox --version 2.0.0
                    
NuGet\Install-Package CoreSuite.PasswordBox -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CoreSuite.PasswordBox" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoreSuite.PasswordBox" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CoreSuite.PasswordBox" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CoreSuite.PasswordBox --version 2.0.0
                    
#r "nuget: CoreSuite.PasswordBox, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CoreSuite.PasswordBox@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CoreSuite.PasswordBox&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CoreSuite.PasswordBox&version=2.0.0
                    
Install as a Cake Tool

CoreSuite PasswordBox

CoreSuite.PasswordBox is a reusable Windows Forms password editor for .NET 8. It combines a borderless TextBox with a right-aligned action button and supports a password-replacement workflow that does not require an already stored password to be loaded into the control.

Features

  • Password entry with system password masking.
  • Embedded action button positioned on the right side.
  • Customizable ShowPasswordImage, HidePasswordImage, and ChangePasswordImage.
  • No built-in images or GDI+ glyphs; the application defines the initial visual identity.
  • Existing-password state without loading the real stored password.
  • Fixed-length placeholder for already stored passwords.
  • Context-sensitive action button that switches between change, show, and hide actions.
  • Password replacement tracking through PasswordChanged.
  • Cancelable replacement workflow.
  • AcceptPasswordChange helper to clear the plaintext replacement value after persistence.
  • Read-only mode.
  • Configurable reveal behavior, button width, image alignment, and mask length.
  • Customizable border colors and localizable tooltips.
  • F2 starts password replacement and Esc cancels it.
  • Accessibility metadata for the embedded action button.
  • Complete XML documentation.

Installation

Install-Package CoreSuite.PasswordBox

Or:

dotnet add package CoreSuite.PasswordBox

Configuring action images

No image is defined by default. Configure them in the Windows Forms Designer or in code:

PasswordBox1.ShowPasswordImage = My.Resources.ShowPassword
PasswordBox1.HidePasswordImage = My.Resources.HidePassword
PasswordBox1.ChangePasswordImage = My.Resources.ChangePassword

The control changes the image automatically according to its current state.

State Property
Password hidden and editable ShowPasswordImage
Password visible and editable HidePasswordImage
Existing password defined ChangePasswordImage

The supplied images are not disposed by PasswordBox; ownership remains with the application or designer resources.

Basic usage

PasswordBox1.PasswordDefined = False
PasswordBox1.PlaceholderText = "Enter password"

When saving:

If PasswordBox1.PasswordChanged Then
    EmailCredentialsService.SavePassword(PasswordBox1.Password)
    PasswordBox1.AcceptPasswordChange()
End If

Existing password workflow

PasswordBox1.PasswordDefined = True

The real stored password does not need to be loaded into the control.

Stored:      [ ••••••••                 ][ change ]
Editing:     [ new password             ][ show   ]
Visible:     [ new password             ][ hide   ]

After successful persistence:

PasswordBox1.AcceptPasswordChange(passwordDefined:=True)

To cancel:

PasswordBox1.CancelPasswordChange()

Main properties

Property Description
PasswordDefined Indicates whether the application already has a stored password.
Password Returns the replacement password currently entered by the user.
PasswordChanged Indicates whether the replacement password has been modified.
IsEditingPassword Indicates whether replacement mode is active.
IsPasswordVisible Indicates whether the replacement password is visible.
ReadOnly Disables editing and replacement.
AllowPasswordReveal Enables or disables password reveal.
ShowActionButton Shows or hides the action button.
ActionButtonWidth Sets the button width.
ActionButtonImageAlign Sets the image alignment in the button.
ShowPasswordImage Image used for the show action.
HidePasswordImage Image used for the hide action.
ChangePasswordImage Image used for the change action.
DefinedPasswordMaskLength Sets the fixed stored-password placeholder length.
MaxLength Sets maximum password length.
TextAlign Sets password text alignment.
ShortcutsEnabled Enables standard text editing shortcuts.
PlaceholderText Sets the empty-field placeholder.
BorderColor Sets normal border color.
FocusedBorderColor Sets focused border color.
DisabledBorderColor Sets disabled border color.
ChangePasswordToolTipText Sets the change action tooltip.
ShowPasswordToolTipText Sets the show action tooltip.
HidePasswordToolTipText Sets the hide action tooltip.

Main methods

Method Description
BeginPasswordChange() Starts password replacement mode.
CancelPasswordChange() Cancels replacement.
AcceptPasswordChange() Marks the replacement as persisted and clears plaintext.
SetPassword() Sets a replacement password programmatically.
ClearPassword() Clears the replacement editor.
SelectAllPassword() Selects the active replacement password.
FocusPassword() Focuses the password editor.

Events

Event Description
PasswordValueChanged Raised when the replacement password changes.
PasswordEditStarted Raised when replacement begins.
PasswordEditCanceled Raised when replacement is canceled.
PasswordVisibilityChanged Raised when password visibility changes.

Security notes

PasswordBox can represent an existing password without receiving the existing plaintext value. The fixed placeholder length does not expose the actual password length.

A password mask is visual protection only and does not encrypt a password while it is being edited.

Requirements

  • .NET 8
  • Windows Forms
  • net8.0-windows

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 83 8/9/2026
1.0.0 91 8/8/2026

Refactored PasswordBox to inherit directly from TextBox, providing native text editing behavior while preserving the embedded customizable image action button, password-defined state, replacement workflow, show/hide functionality, fixed-length stored-password placeholder, change tracking, cancellation, acceptance flow, accessibility support and complete XML documentation. Removed the previous UserControl-based layout and custom border properties.