Gets or sets whether the TextBox control modifies the case of characters as they are typed.
[Visual Basic] Public Property CharacterCasing As CharacterCasing [C#] public CharacterCasing CharacterCasing {get; set;} [C++] public: __property CharacterCasing get_CharacterCasing(); public: __property void set_CharacterCasing(CharacterCasing); [JScript] public function get CharacterCasing() : CharacterCasing; public function set CharacterCasing(CharacterCasing);
A CharacterCasing value that specifies whether the TextBox control modifies the case of characters. The default is CharacterCasing.Normal.
You can use the CharacterCasing property to change the case of characters as required by your application. For example, you could change the case of all characters entered in a TextBox control used for password entry to uppercase or lowercase to enforce a policy for passwords.
The following example creates a TextBox control that is used to accept a password. This example uses the CharacterCasing property to change all characters typed to uppercase and the MaxLength property to restrict the password length to eight characters. This example also uses the TextAlign property to center the password in the TextBox control.
[Visual Basic]
Public Sub CreatePasswordTextBox() ' Create an instance of the TextBox control. Dim Text1 as TextBox Set Text1 = New TextBox 'Text1.MaxLength = 8 ' Assign the asterisk to be the password character. Text1.PasswordChar = "*" ' Change all text entered to be lowercase. Text1.CharacterCasing = CharacterCasing.Upper ' Align the text in the center of the TextBox control. Text1.TextAlign = HorizontalAlignment.Center End Sub
TextBox Class | TextBox Members | System.WinForms Namespace | CharacterCasing