CharacterCasing (Enumeración)
Actualización: noviembre 2007
Especifica el uso de mayúsculas de los caracteres de un control TextBox.
Ensamblado: System.Windows.Forms (en System.Windows.Forms.dll)
Utilice los miembros de esta enumeración para establecer el valor de la propiedad CharacterCasing del control TextBox.
En el siguiente ejemplo se crea un control TextBox que se utiliza para aceptar una contraseña. En este ejemplo se usa la propiedad CharacterCasing para cambiar a mayúsculas todos los caracteres escritos, y la propiedad MaxLength para restringir la longitud de la contraseña a ocho caracteres. En este ejemplo también se utiliza la propiedad TextAlign para centrar la contraseña en el control TextBox.
public void CreateMyPasswordTextBox() { // Create an instance of the TextBox control. TextBox textBox1 = new TextBox(); // Set the maximum length of text in the control to eight. textBox1.MaxLength = 8; // Assign the asterisk to be the password character. textBox1.PasswordChar = '*'; // Change all text entered to be lowercase. textBox1.CharacterCasing = CharacterCasing.Lower; // Align the text in the center of the TextBox control. textBox1.TextAlign = HorizontalAlignment.Center; }
public void CreateMyPasswordTextBox()
{
// Create an instance of the TextBox control.
TextBox textBox1 = new TextBox();
// Set the maximum length of text in the control to eight.
textBox1.set_MaxLength(8);
// Assign the asterisk to be the password character.
textBox1.set_PasswordChar('*');
// Change all text entered to be lowercase.
textBox1.set_CharacterCasing(CharacterCasing.Lower);
// Align the text in the center of the TextBox control.
textBox1.set_TextAlign(HorizontalAlignment.Center);
} //CreateMyPasswordTextBox
public function CreateMyPasswordTextBox() { // Create an instance of the TextBox control. textBox1 = new TextBox(); // Set the maximum length of text in the control to eight. textBox1.MaxLength = 8; // Assign the asterisk to be the password character. textBox1.PasswordChar = '*'; // Change all text entered to be lowercase. textBox1.CharacterCasing = CharacterCasing.Lower; // Align the text in the center of the TextBox control. textBox1.TextAlign = HorizontalAlignment.Center; }
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.