Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Upper case the 1st letter of a word on the TextBox key press

Upper case the 1st letter of a word on the TextBox key press

Scheduled Pinned Locked Moved Visual Basic
csharphelptutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Robo16
    wrote on last edited by
    #1

    Hiya, I hope that you can help. Does anybody know how to force the 1st letter of each word in a TextBox to upper case as the key is pressed? The idea is that a user would be able to enter a name or address etc and the 1st letters of each word would automatically be changed to a capital letter WITHOUT the user having to hold down the shift key. I was able to do this OK in VB6. I would just test the ascii value of the previous character that had been pressed. If the length of the string was zero OR the previous character was a space, I would just change the letter to upper case as shown below. KeyAscii = Asc(UCase(Chr(KeyAscii))) I know that the .Net TextBox has a CharacterCasing property but that just uppercases or lowercases all the characters. Thanx Rob

    M 1 Reply Last reply
    0
    • R Robo16

      Hiya, I hope that you can help. Does anybody know how to force the 1st letter of each word in a TextBox to upper case as the key is pressed? The idea is that a user would be able to enter a name or address etc and the 1st letters of each word would automatically be changed to a capital letter WITHOUT the user having to hold down the shift key. I was able to do this OK in VB6. I would just test the ascii value of the previous character that had been pressed. If the length of the string was zero OR the previous character was a space, I would just change the letter to upper case as shown below. KeyAscii = Asc(UCase(Chr(KeyAscii))) I know that the .Net TextBox has a CharacterCasing property but that just uppercases or lowercases all the characters. Thanx Rob

      M Offline
      M Offline
      Mohammed Amine
      wrote on last edited by
      #2

      well , i hope i can help in vb.net in the event : Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles PrixVerreDP.KeyPress see that e i wrote over ?? this is the stuff you look for now write ascii = asc(e.keychar) to get the code ascii of the letter you typed i hope this helped you try to be good if you can't be the best

      R 1 Reply Last reply
      0
      • M Mohammed Amine

        well , i hope i can help in vb.net in the event : Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles PrixVerreDP.KeyPress see that e i wrote over ?? this is the stuff you look for now write ascii = asc(e.keychar) to get the code ascii of the letter you typed i hope this helped you try to be good if you can't be the best

        R Offline
        R Offline
        Robo16
        wrote on last edited by
        #3

        Thanks for your lightning response. I was just surfing the web looking for an answer and found a suite of controls called ITTeamControls .Net. It extends the existing CharacterCasing property with a UpperFirst value. So there is no need for any coding. Think we might buy a few licences. The product landing page is http://www.itteam.net/itteamcontrols.html[^] Rob

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups