winforms
textbox
passwordchar
black dot
UI components

Which passwordchar shows a black dot • in a winforms textbox?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

In a WinForms TextBox, the black-dot character people usually want is the Unicode bullet , which is \u2022. You can assign that character to PasswordChar, but there is one important caveat: the final appearance still depends on the control's font and the operating system's text rendering.

Set PasswordChar to the Bullet Character

The direct answer is:

csharp
textBox1.PasswordChar = '\u2022';

You can also write the literal directly if the source file encoding supports it:

csharp
textBox1.PasswordChar = '•';

That tells the TextBox to display the bullet glyph for each entered character instead of the real text.

PasswordChar Versus UseSystemPasswordChar

There are two related ways to mask text in WinForms:

  • 'PasswordChar'
  • 'UseSystemPasswordChar'

Example:

csharp
textBox1.UseSystemPasswordChar = true;

UseSystemPasswordChar lets Windows choose the masking glyph according to system behavior. If the goal is "make it look native on this machine," that is often better than forcing one exact character. If the goal is specifically "show a bullet," set PasswordChar yourself.

The two properties should not be treated as unrelated. In practical UI code, you usually choose one strategy:

  • explicit bullet with PasswordChar
  • native OS masking with UseSystemPasswordChar

The Font Still Matters

A common surprise is that \u2022 does not always look the same. The control will render whatever glyph the active font provides for that code point. On one font it may appear as a solid dot. On another it may look smaller, higher, lighter, or slightly different from the system password mask.

That is why developers sometimes think they chose the wrong character when the real issue is font selection. If exact appearance matters, test the TextBox with the same font your form uses in production.

Minimal Working Example

csharp
1using System;
2using System.Windows.Forms;
3
4public class LoginForm : Form
5{
6    private readonly TextBox passwordBox = new TextBox();
7
8    public LoginForm()
9    {
10        passwordBox.Left = 20;
11        passwordBox.Top = 20;
12        passwordBox.Width = 200;
13        passwordBox.PasswordChar = '\u2022';
14        Controls.Add(passwordBox);
15    }
16
17    [STAThread]
18    public static void Main()
19    {
20        Application.EnableVisualStyles();
21        Application.Run(new LoginForm());
22    }
23}

This is enough to render a password field with a bullet mask in a standard WinForms app.

Security Reminder

Masking the display does not secure the password by itself. PasswordChar only changes what the user sees on screen. It does not encrypt the value, protect it in memory, or prevent insecure logging elsewhere in the application.

That matters because UI masking is often confused with password handling. They solve different problems:

  • masking helps prevent shoulder surfing
  • secure storage and transmission protect the actual secret

It is also worth thinking about accessibility and consistency. If the application needs to look native on different Windows themes and fonts, UseSystemPasswordChar may provide a better user experience than forcing one exact glyph.

Common Pitfalls

  • Using the wrong Unicode character when the intended bullet is \u2022.
  • Forgetting that the rendered glyph depends on the TextBox font.
  • Expecting PasswordChar to look identical to the native system password mask on every machine.
  • Setting both PasswordChar and UseSystemPasswordChar without deciding which behavior should win.
  • Assuming a masked TextBox makes password handling secure by itself.

Summary

  • The usual black-dot password character is the Unicode bullet \u2022.
  • Set it with textBox.PasswordChar = '\u2022';.
  • Use UseSystemPasswordChar instead if you want the operating system's native mask.
  • Test the chosen glyph with the actual font used by the control.
  • Remember that display masking is a UI feature, not a full security solution.

Course illustration
Course illustration

All Rights Reserved.