How to Capitalize the First Letter on a Text Box in VB6

this time i will show you on how to capitalize every first letter of a word in a Text box Control,
follow the codes below:

This code will write on a module as a function just copy and paste on a module

Public capT As Object

Public Sub cap(frm As Form)
cr = vbCrLf

For Each capT In frm.Controls
 If TypeOf capT Is vkTextBox Then
 t = capT.Text
        If t <> "" Then
         Mid$(t, 1, 1) = UCase$(Mid$(t, 1, 1))
         For i = 1 To Len(t) - 1
           If Mid$(t, i, 2) = cr Then Mid$(t, i + 2, 1) 
               = UCase$(Mid$(t, i + 2, 1))
           If Mid$(t, i, 1) = " " Then Mid$(t, i + 1, 1) 
             = UCase$(Mid$(t, i + 1, 1))
         Next
         capT.Text = t
        End If
    End If
Next capT
End Sub

Hope you Like it
Happy Coding
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Leave a comment

Copyright @ Codes-47.Blogspot.Com. Powered by Blogger.