huseyint
huseyint

Reputation: 15081

Reveal password textbox control on windows

Are there any APIs in Windows to turn a password textbox into something like this:

enter image description here

So that users will be able to reveal the password for a second while pressing the eye icon right next to textbox. Do you know any P/Invoke like API exists that I can call from my WinForms app?

Upvotes: 5

Views: 3769

Answers (1)

LarsTech
LarsTech

Reputation: 81620

No need for an API for that, you just toggle it yourself:

textBox1.PasswordChar = textBox1.PasswordChar == '\0' ? '*' : '\0';

For placing a button inside a textbox, see Button inside a winforms textbox

Upvotes: 4

Related Questions