How to convert string to uppercase in windows textbox?

Sukanya picture Sukanya · Apr 11, 2012 · Viewed 54.5k times · Source

I've a textbox in my windows application. It allows only alphabets and digits. I want when ever I type any alphabet, it should be converted to uppercase.How can I do that and in which event? I've used str.ToUpper() but the cursor is shifting to the beginning of the string. Please give me solution.

Answer

Ezio Auditore da Firenze picture Ezio Auditore da Firenze · Apr 11, 2012

You just need to change CharacterChasing property to Upper.

textBox1.CharacterCasing = CharacterCasing.Upper