for this post we will discuss a function that can change every initial letter on a word into uppercase or capslock.
Now let's move to editor mode, click View -> Code, and enter the following code :
Public Function AwalKataKapital(strKalimat As String) Dim i As Integer Dim Temp As String Dim Lokasi As Integer Dim huruf As String * 1 Temp$ = "" For i% = 1 To Len(strKalimat) huruf = Chr(Asc(Mid(strKalimat, i%, 1))) If Len(Trim(huruf)) < 1 Then Lokasi% = i% + 1 End If If i% = Lokasi% Or i% = 1 Then Temp$ = Temp$ + UCase(Chr(Asc(Mid(strKalimat, _ i%, 1)))) Else Temp$ = Temp$ + LCase(Chr(Asc(Mid(strKalimat, _ i%, 1)))) End If Next i AwalKataKapital = Temp$ End Function
Private Sub Text1_Change() Dim posisi As Integer posisi = Text1.SelStart Text1.Text = AwalKataKapital(Text1.Text) Text1.SelStart = posisi End Sub
Press F5 to run the project, you try to type some words in the textbox we have provided, then every letter of the beginning of the word will automatically turn into capital letters.
Good luck.
3 comments
commentsMakasih atas sc nya
ReplyMANTEP MAS bro .
Replymantab...., terima kasih banyak...
Reply