Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

uppercase? 3

Status
Not open for further replies.

Fursten

Programmer
Dec 27, 2000
403
PT
Hi,

While the user is inserting some characteres in a textbox, I would like to make those characteres uppercase. The goal is not to make the word uppercase when it is all written but while it is been written.

The code I have to do that is this:

Dim lcl_i As Integer
Dim lcl_cripta As String

TXT_DecPrf.SelLength = Len(TXT_DecPrf.Text) ' set selection length.
For lcl_i = 1 To Len(TXT_DecPrf.Text)
lcl_cripta = lcl_cripta + UCase(Mid(TXT_DecPrf.Text, lcl_i, 1))
Next
TXT_DecPrf.Text = lcl_cripta
TXT_DecPrf.SelStart = Len(TXT_DecPrf.Text)


However this code seems to much complicate to do just a simple thing...

anyone knwos a better way of doing this?

Thank you

Sergio Oliveira
 
Hi

Try this:

------------------------------------------------
Private Sub Text1_Change()
Text1.Text = UCase(Text1.Text)
Text1.SelStart = Len(Text1.Text)
End Sub
-------------------------------------------------

Sunaj
 
Try putting this in the KeyPress Event of the textbox.

KeyAscii = Asc(UCase(Chr(KeyAscii)))

RKA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top