VB6.0 : Setting textbox to Caps Lock

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wassup
    New Member
    • May 2007
    • 34

    VB6.0 : Setting textbox to Caps Lock

    Hi all,

    I need a help again. How to set the textbox auto change to Upper Case without on the Caps Lock Key.
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Originally posted by wassup
    Hi all,

    I need a help again. How to set the textbox auto change to Upper Case without on the Caps Lock Key.
    Hiya, wassup!

    I think it's somewhere in the line of :

    Code:
    UCase(Text1.Text)
    What is this for anyway?

    You may also need SelStart in there

    Code:
    Text1.Text = UCase$(Text1.SelStart)
    Check it, I am typing this up from memory, but SelStart makes it that whatever is typed in according to the case specified.

    Dököll

    Comment

    • wassup
      New Member
      • May 2007
      • 34

      #3
      hi Dokoll,

      i have try but its not working. its that key in at Form_load()?

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Try this...
        Code:
        Private Sub Text1_KeyPress(KeyAscii As Integer)
          Select Case KeyAscii
            Case 97 To 122
              KeyAscii = KeyAscii - 32
          End Select
        End Sub

        Comment

        • wassup
          New Member
          • May 2007
          • 34

          #5
          Originally posted by Killer42
          Try this...
          Code:
          Private Sub Text1_KeyPress(KeyAscii As Integer)
            Select Case KeyAscii
              Case 97 To 122
                KeyAscii = KeyAscii - 32
            End Select
          End Sub
          thanks killer. i got another source code too.
          Code:
          Private Sub txtPro_KeyPress(KeyAscii As Integer)
             KeyAscii = Asc(UCase(Chr(KeyAscii)))
          End Sub

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by wassup
            thanks killer. i got another source code too.
            Code:
            Private Sub txtPro_KeyPress(KeyAscii As Integer)
               KeyAscii = Asc(UCase(Chr(KeyAscii)))
            End Sub
            Good idea. My version will be very language-specific. The Ucase function might be a bit smarter.

            Comment

            • drepunkz
              New Member
              • Mar 2013
              • 1

              #7
              Great

              Originally posted by Killer42
              Try this...
              Code:
              Private Sub Text1_KeyPress(KeyAscii As Integer)
                Select Case KeyAscii
                  Case 97 To 122
                    KeyAscii = KeyAscii - 32
                End Select
              End Sub
              Thanks it's working..

              Comment

              • commutronics
                New Member
                • Feb 2014
                • 1

                #8
                textbox in vb6.0 auto caps letter

                Your idea works good..

                Comment

                Working...