Make TextBoxes automatically convert to lower case or upper case in C#

This is actually quite easy in .NET. If you set a TextBox's CharacterCasing property to Lower or Upper, the controls automatically converts alphabetic characters into the correct case. You can do this at design time, although in this example I set the properties in the following code so they are easy to see:

private void Form1_Load(object sender, EventArgs e)
{
    txtLowerCase.CharacterCasing = CharacterCasing.Lower;
    txtUpperCase.CharacterCasing = CharacterCasing.Upper;
}

   

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments
  • No comments exist for this post.
Leave a comment

Submitted comments are subject to moderation before being displayed.

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.