CharacterCasing Enum

Definition

Anger fallet med tecken i en TextBox kontroll.

public enum class CharacterCasing
public enum CharacterCasing
type CharacterCasing = 
Public Enum CharacterCasing
Arv
CharacterCasing

Fält

Name Värde Description
Normal 0

Teckenfallet lämnas oförändrat.

Upper 1

Konverterar alla tecken till versaler.

Lower 2

Konverterar alla tecken till gemener.

Exempel

I följande exempel skapas en TextBox kontroll som används för att acceptera ett lösenord. I det CharacterCasing här exemplet används egenskapen för att ändra alla tecken som skrivs till versaler och MaxLength egenskapen för att begränsa lösenordslängden till åtta tecken. I det här exemplet används TextAlign även egenskapen för att centrera lösenordet i TextBox kontrollen.

public:
   void CreateMyPasswordTextBox()
   {
      // Create an instance of the TextBox control.
      TextBox^ textBox1 = gcnew 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.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 Sub CreateMyPasswordTextBox()
    ' Create an instance of the TextBox control.
    Dim textBox1 As 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 = "*"c
    ' 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
End Sub

Kommentarer

Använd medlemmarna i den här uppräkningen för att ange värdet för CharacterCasing kontrollens TextBox egenskap.

Gäller för