abduls85
abduls85

Reputation: 548

Question related to textbox used to keyin password

I am developing a c# winform application. The application will minimize to the system tray, and there are two options for the user to choose from, show and exit . Both are working well. Right now i need to implement a function whereby when the user chooses exit, I need to display a textbox for the user to key in his/her password just above the system tray. The inputbox must mask the character type by the user as the user will be typing his/her password. I want to know whether there are any other way other than creating a new form with a textbox to fulfill this feature.

I tried to import use the visual basic textbox to perform this but unfortunately, I cannot mask the characters typed by the user. Are there any other way to do so other than creating a new form?

Upvotes: 2

Views: 182

Answers (3)

Gustavo Mori
Gustavo Mori

Reputation: 8386

There's no out-of-the-box solution for what you're trying to do, but the .NET Framework makes available to you all the components to easily make it happen.

  • The bad news: you need to create a new form that contains the input fields you want to display to users.
  • The good news: you can use a standard TextBox, and set it so it will hide the password characters.

There are two parts to showing a password TextBox:

  1. Set the TextBox to hide password characters
  2. Choose the character to display for passwords

Upvotes: 1

SLaks
SLaks

Reputation: 888167

You're looking for the Textbox.UseSystemPasswordChar property.

Upvotes: 2

Related Questions