[C# Helper]
Index Books FAQ Contact About Rod
[Essential Algorithms, Second Edition]

[The Modern C# Challenge]

[WPF 3d, Three-Dimensional Graphics with WPF and C#]

[The C# Helper Top 100]

[Interview Puzzles Dissected]

[C# 24-Hour Trainer]

[Beginning Software Engineering]

[C# 5.0 Programmer's Reference]

[MCSD Certification Toolkit (Exam 70-483): Programming in C#]

Title: Make TextBoxes automatically convert case in C#

[Make TextBoxes automatically convert case in C#]

It's actually quite easy to make a TextBox convert case in .NET. Simply set the TextBox control's CharacterCasing property to Lower or Upper. Then the control 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; }

That's all there is to making a TextBox convert case, at least to upper and lower case. My next two posts will look at proper case, where each word in a phrase is capitalized.

Download the example to experiment with it and to see additional details.

© 2009-2022 Rocky Mountain Computer Consulting, Inc. All rights reserved.