Thats exactly what I dont want to do, is have to do that for EVERY thing they type in, thats going to be tons of redundant code, there are probably 40 textboxes on 1 screen.
I want when they press "i" it shows up as "I" not after the fact. I guess i could derive something from text box that implements this but the problem with that code is that it sets
the cursor back to the beginning of the text so if your typing
fast it will come out TSAF. Know how to set the cursor to the end of whats been typed?
You could capture the KeyDown event. If the ASCII code of the key is within the range of lowercase letters, add or subtract the difference to the uppercase letters.
I would recommend creating a new control that extends textbox. Create this functionality. Then do a replace in your code to change TextBox() to YourTextBox()
Yeah i think i am going to create a new control.
The problem is the behavior of
this.TB.Text=this.TB.Text.ToUpper()
is a key press event is not trivial.
I cant understand why it reverses the text when its a lower case letter but not when its a upper case one.
So if i type in iMcG iget GMCI, i dont follow the logic, i would think that it would reverse the text(well its not really reversing it it's setting the cursor to the beginning of the text field AFTER it converts the lower case to upper, but does
not appear to be doing it when the origial letter was already uppercase. I'd still think that it would at least do a replace With the exact same text and reset the cursor but it does not appear to be doing so) and i cant figure out how to advance the cursor after a key press.
when you do .ToUpper(), it resets the cursor. If you capture the keydown event, you can change the value of the key before it even reaches the textbox. This way, you don't have to worry about the string reversing.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Im using .NET mobile Framework, so that doesnt work.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.