Forcing Case in Textbox

S

Sidney Mark Croy

Greetings

In VB6 you could change case to upper or lower within the KeyPress event
handling. How do you accomplish that within VB.NET?

Thank you

SMCroy
 
K

Ken Tucker [MVP]

Hi,

The textbox has a charactercasing property. You can select upper,
lower, or none.

txtName.CharacterCasing = CharacterCasing.Upper

txtName.CharacterCasing = CharacterCasing.Lower

Ken
 
O

One Handed Man

Also, you can use the string convert function

TextBox1.text = StrConv(TextBox1.text, VbStrConv.LowerCase)

There are a number of usefull conversions such as VbStrConv.ProperCase which
can be used also.

Regards and HTH

OHM'ster
 
D

David Ricker

You could simply use the CharacterCasing property of the textbox.

Thanks,
David J. Ricker II
 
O

One Handed Man

Yes you could. BUT, there are only three variants on character casing.
Normal, Upper and Lower. My solution allows for more variations such as
proper case.

I think we had this discussion once before ;-)

Rehards OHM'ster
 
H

Herfried K. Wagner [MVP]

* "One Handed Man said:
Yes you could. BUT, there are only three variants on character casing.
Normal, Upper and Lower. My solution allows for more variations such as
proper case.

ACK. That's a limitation, but very often we don't need more that that.
I think we had this discussion once before ;-)

:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top