How to hide a password in C#

Asked

Viewed 1,320 times

3

I want to hide my password.

What I want to happen is that while I type " * " is shown instead of characters, the problem is that it only happens when I click on the "Log in".

Yes, I know this happens because the commands are inside the event block of the button, but how can I get them out of there?

I tried to do it outside the event but I can’t use the text box, which I can do?

2 answers

4


Just define the property PasswordChar from Textbox, no extra event needed.

txtSenha.PasswordChar = '*';

4

Browser other questions tagged

You are not signed in. Login or sign up in order to post.