Text Field Custom Password Character

Hello everyone,

How would you guys change a password text field “omit” character ?

By default (at least in Windows) is an asterisk.

Thanks

[quote=133602:@Walter Sander]Hello everyone,

How would you guys change a password text field “omit” character ?

By default (at least in Windows) is an asterisk.[/quote]

  • Place a transparent label over a textfield.
  • Make the textfield text color white
  • In the TextField TextChange event, do something like :

Label1.Text = "" for i as integer = 1 to len(me.text) Label1.Text = Label1.Text+&u25CF next

Use a monospaced font such as Courier New to insure synchronization of the caret (text cursor) between TextField and Label. I used size 10 and it works fine for the dot character above.

Thanks, that’s my workaround too.
Was just wondering whether the textField has such possibility.

Do you mean hiding the input text by using a “password character” ?

If so - it is a simple property setting

Nevermind - I’m guessing you want to change the default character to one of your own.

Yes, the character is the issue, not the property :wink:

Hi Walter

I made this example with the following characteristics:
* Allows you to choose any letter
* Deletion of a character regardless of where you are
* Deletion of the entire password
* Configurable Password Length
* Allows to write the password space

No doubt it can be improved, I hope will be helpful
Capture:

Example:

Javier, thanks for the Super. Works flawlessly :slight_smile:

Hi Walter,

on Windows, you have this solution with the API :

Declare sub SendMessage lib "User32" alias "SendMessageW" (hwnd As integer, msg As integer, wParam As Integer, lParam as Integer) Dim EM_SETPASSWORDCHAR as Integer = &HCC SendMessage (TextField1.Handle, EM_SETPASSWORDCHAR, asc("?"),0) // TextField1 is the name of the control, change ? for another character

It’s work on Windows 7…

[quote=266675:@Pierre BONE]Declare sub SendMessage lib “User32” alias “SendMessageW” (hwnd As integer, msg As integer, wParam As Integer, lParam as Integer)
Dim EM_SETPASSWORDCHAR as Integer = &HCC
SendMessage (TextField1.Handle, EM_SETPASSWORDCHAR, asc("?"),0) // TextField1 is the name of the control, change ? for another character[/quote]
Men, you are great!!! very very thanks!!!