Jam Dara
Jam Dara

Reputation: 249

vb.net textbox not using the password character setting

I have a textbox in Visual Studio 2005 with the PasswordChar property set to *. However, when I check it I still see the text like normal. I expected to only see * characters. I'm running Windows XP. Any ideas?

    'PasswordTextBox
    '
    Me.PasswordTextBox.Location = New System.Drawing.Point(131, 93)
    Me.PasswordTextBox.Multiline = True
    Me.PasswordTextBox.Name = "PasswordTextBox"
    Me.PasswordTextBox.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42)
    Me.PasswordTextBox.Size = New System.Drawing.Size(207, 25)
    Me.PasswordTextBox.TabIndex = 3

Upvotes: 0

Views: 4133

Answers (1)

qwr
qwr

Reputation: 3670

I guess you set multiline.

If the Multiline property is set to true, setting the PasswordChar property has no visual effect

Full remark from MSDN:

Remarks

The UseSystemPasswordChar property has precedence over the PasswordChar property. Whenever the UseSystemPasswordChar is set to true, the default system password character is used and any character set by PasswordChar is ignored.

If the Multiline property is set to true, setting the PasswordChar property has no visual effect. When the PasswordChar property is set to true, cut, copy, and paste actions in the control using the keyboard cannot be performed, regardless of whether the Multiline property is set to true or false.

Source: MSDN.

Upvotes: 2

Related Questions