by Joselito Sanchez (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 7th August 2010
Date Added: Mon 8th February 2021
Rating: (1 Votes)
PROPER CASED TEXTBOX INPUT
'original submission by Renato Gesulga:
'code submitted: http://www.vbcode.com/Asp/showsn.asp?theID=13302
'hi friend,
'just read your submission on VBCode.com. nice original idea. it really helps!
'but would you mind friend if i revise a little bit of your code.
'i just want to be fair with you...this is for the benefit of the beginners...
'I presume you already revised the code, and i apologize if you already did. what
'what i mean is that when i run your code it messed up at the last character set by
'the "selstart". sure it runs without any error at the set length.
'why not make it indefinite length, make it a function so that it can be
'easily called by any textbox.
'as in the following code:
'----------------------------------------
Private Function Proper_Case(Text As TextBox)
Text.Text = StrConv(Text.Text, vbProperCase)
Text.SelStart = Len(Text.Text) 'this is the trick to get rid of the annoying input at the end of the set length
Proper_Case = Text
End Function
'----------------------------------------
'.... call the function from all the textboxes you want Proper cased
'----------------------------------------
Private Sub Text1_KeyPress(KeyAscii As Integer)
Proper_Case Text1
End Sub
'----------------------------------------
'.... and so on...
'this is for beginners out there...
'it would be nicer if we share ideas? it would be great!
'am an avid fan of vb, too, an enthusiast for short.
'please email me for comments....i would be glad to make friends...
'joselito sanchez
'[email protected]