VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Changes first letter of each word in either TextBox or ComboBox into Capital using StrConv.

by nofx (8 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Fri 14th January 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Changes first letter of each word in either TextBox or ComboBox into Capital using StrConv.

Rate Changes first letter of each word in either TextBox or ComboBox into Capital using StrConv.




Function ccProperCase(MySourceControl As Control)
'-------------------------------------------------------'
'This Function turns first letter of the word           '
'into the Uper case if its in the low case.             '
'-------------------------------------------------------'
On Error GoTo ErrH

Dim strString As String
    
    strString = MySourceControl.Text
    If IsNull(strString) Then Exit Function
    strString = StrConv(strString, vbProperCase)
    MySourceControl.SelStart = Len(strString)
    MySourceControl.Text = strString

Exit Function
ErrH:
    MsgBox "Error at ccProperCase:::- " & Err.Number & " - " & Err.Description, vbCritical
    Exit Function
End Function

2. Place the ComboBox on your form and Copy this code.

Private Sub Combo1_Change()
    Call ccProperCase(Combo1)
End Sub

3. Run the program and try to type something in the ComboBox.


Download this snippet    Add to My Saved Code

Changes first letter of each word in either TextBox or ComboBox into Capital using StrConv. Comments

No comments have been posted about Changes first letter of each word in either TextBox or ComboBox into Capital using StrConv.. Why not be the first to post a comment about Changes first letter of each word in either TextBox or ComboBox into Capital using StrConv..

Post your comment

Subject:
Message:
0/1000 characters