?
Solved

Convert lower case letters to upper case

Posted on 2003-03-24
9
Medium Priority
?
364 Views
Last Modified: 2010-04-07
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
Comment
Question by:dantivilo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 5

Expert Comment

by:Cimperiali
ID: 8195710
Private sub text1_keyUp()
  text1.text =ucase(text1.text)
end sub
0
 
LVL 2

Expert Comment

by:Jacamar
ID: 8195752
you should do it in the Text1_Change() event
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8195764
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
End Sub
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Accepted Solution

by:
GivenRandy earned 75 total points
ID: 8195812
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
 
LVL 2

Expert Comment

by:Jacamar
ID: 8198412
Although you selected an answer already, you should know that Emoreau's solution is the most effienient.  I suggest using it.
0
 
LVL 5

Expert Comment

by:Cimperiali
ID: 8201097
I agree: Emoreau gives you the most appropriate code.
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 8202877
I would agree, if it only applied to key presses. How about if someone does a copy-and-paste (e.g., control-C)?
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 8202885
... or control-V (paste) which generates a KeyPress of 22?
0
 
LVL 2

Expert Comment

by:Jacamar
ID: 8202983
Good Point
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month11 days, 9 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question