TextBox.CharacterCasing Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee wordt opgehaald of ingesteld of het TextBox besturingselement het hoofdlettergebruik wijzigt terwijl deze worden getypt.
public:
property System::Windows::Forms::CharacterCasing CharacterCasing { System::Windows::Forms::CharacterCasing get(); void set(System::Windows::Forms::CharacterCasing value); };
public System.Windows.Forms.CharacterCasing CharacterCasing { get; set; }
member this.CharacterCasing : System.Windows.Forms.CharacterCasing with get, set
Public Property CharacterCasing As CharacterCasing
Waarde van eigenschap
Een van de CharacterCasing opsommingswaarden die aangeeft of het TextBox besturingselement het hoofdlettergebruik wijzigt. De standaardwaarde is CharacterCasing.Normal.
Uitzonderingen
Een waarde die zich niet binnen het bereik van geldige waarden voor de opsomming bevindt, is toegewezen aan de eigenschap.
Voorbeelden
In het volgende codevoorbeeld wordt een TextBox besturingselement gemaakt dat wordt gebruikt om een wachtwoord te accepteren. In dit voorbeeld wordt de CharacterCasing eigenschap gebruikt om alle tekens te wijzigen die zijn getypt in kleine letters en de MaxLength eigenschap om de wachtwoordlengte te beperken tot acht tekens. In dit voorbeeld wordt ook de TextAlign eigenschap gebruikt om het wachtwoord in het TextBox besturingselement te centreren.
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
Opmerkingen
U kunt de CharacterCasing eigenschap gebruiken om het hoofdlettergebruik van tekens te wijzigen zoals vereist voor uw toepassing. U kunt bijvoorbeeld het geval wijzigen van alle tekens die zijn ingevoerd in een TextBox besturingselement dat wordt gebruikt voor het invoeren van wachtwoorden in hoofdletters of kleine letters om een beleid voor wachtwoorden af te dwingen.