0

我在 Visual Studio 2005 中有一个文本框,其中 PasswordChar 属性设置为*. 但是,当我检查它时,我仍然看到正常的文本。我希望只看到*字符。我正在运行 Windows XP。有任何想法吗?

    '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
4

1 回答 1

2

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.

于 2013-06-28T05:13:22.017 回答