• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

Convert lower case letters to upper case

if i have a txt box and i want to make a code that will atomatically make every letter on the txt box upper case. (vb)
0
dantivilo
Asked:
dantivilo
  • 3
  • 3
  • 2
  • +1
1 Solution
 
CimperialiCommented:
Private sub text1_keyUp()
  text1.text =ucase(text1.text)
end sub
0
 
JacamarCommented:
you should do it in the Text1_Change() event
0
 
Éric MoreauSenior .Net ConsultantCommented:
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
End Sub
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
GivenRandyCommented:
If you want to do it as it is being typed, use the one of the following code in the _Change() or _KeyPress() events. If you want to do it functionally use either of these:

Text1.Text = UCase(Text1.Text)

Text1.Text = Format$(Text1.Text, ">")
0
 
JacamarCommented:
Although you selected an answer already, you should know that Emoreau's solution is the most effienient.  I suggest using it.
0
 
CimperialiCommented:
I agree: Emoreau gives you the most appropriate code.
0
 
GivenRandyCommented:
I would agree, if it only applied to key presses. How about if someone does a copy-and-paste (e.g., control-C)?
0
 
GivenRandyCommented:
... or control-V (paste) which generates a KeyPress of 22?
0
 
JacamarCommented:
Good Point
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now