Code Menset Isi Text Box Menjadi Sentence Case

Option Explicit
Dim KP As Boolean

Dim SpaceBar As String
Dim strResult, strTemp As String

Private Sub KeyPress(KeyAscii As Integer)
On Error Resume Next
If Len(Text1) = 1 Then
strResult = Text1
strResult = UCase$(Left$(strResult, 1)) & Mid$(strResult, 2)
Text1 = strResult
Text1.SelStart = Len(strResult) + 1
ElseIf SpaceBar = "Y" Then
strTemp = UCase$(Right$(Text1, 1))
Text1 = strResult & strTemp
Text1.SelStart = Len(strResult) + 1
SpaceBar = ""
End If
strResult = Text1

If KeyAscii = 32 Then
KP = True
ElseIf KP = True Then
SpaceBar = "Y"
KP = False
End If
End Sub

Postingan populer dari blog ini

Load Dan Insert Image ke MySQL BLOB dengan VB6

Jawaban UTS MK. Sistem Operasi

Sistem Operasi