capitalize the data in textbox

aman

Registered User.
Local time
Today, 02:14
Joined
Oct 16, 2008
Messages
1,251
Hi guys

I have a very simple questions. whenever the user starts typing anything in the textbox then it should automatically convert each character to uppercase. I don't want to use the after update event on it. Whenever the user type character by character in the textbox then it should be in the capital letter.

Thanks for your help in advance!

Aman
 
Use the UCASE() function.

UCASE([Name_Of_Field])

Or you could use the Format property of the control.
 
i know we can use ucase function like
Code:
txtname=ucase(txtname)

but what I want to acheive is whenever the user starts typing characters in the textbox then they should appear capital.suppose the name is "aman".when the user types a then it should display capital in the textbox ,then user types m ,again it shouls display capital and so on.so which event shall i use for this.

Thanks
Aman
 
I have written the following code:
Code:
Private Sub Text0_Change()
Text0 = UCase(Text0)
End Sub

But i am not able to type anything in the textbox.
 
What is the error message? What does it display on the status bar when you try to type in text?

This is the correct way to do it. You need to refer to the Text property:

Code:
Text0.Text = UCase(Text0.Text)
 
Yes, It does covert the characters in uppercase but not in the right order. Like if i type aman, then it would come up NAMA, which is not the right order of characters.

Thanks
 
At least you're getting UPPERCASE (but in reverse) :D

There must be something that's causing it to get reversed. Do you have any other code that is run in the text box?

Check the ReadingOrder property of the text box. Is it Right-To-Left or Left-To-Right?
 
The reading order property is set to Context. but when i change it to right-to-left or let-to-right then it doesn't makes any difference.
 
Can anyone else please help me to solve my problem.

Thanks
Aman
 
Try

Code:
KeyAscii = Asc(UCase(Chr(KeyAscii)))
...in the on key press event of your control.

You still might want to consider an afterupdate event for instances of copy/paste, which will make the above code redundant but you gotta cover all bases i guess...
 
Thanks a lot for your help. It worked gr8.
 

Users who are viewing this thread

Back
Top Bottom