Ireland1978
Programmer
Code:
Private Sub txtName_KeyPress(KeyAscii As Integer)
Dim i As Integer
i = 0
Do
If KeyAscii >= "a" And KeyAscii <= "z" Then
If i = 0 Then
UCase (Chr$(KeyAscii))
End If
i = i + 1
Else
If KeyAscii = " " Then
i = 0
End If
Loop While txtName.Text
End Sub
I'm trying to capatilize the first letter of each word entered by the user into a text box. They must be capatilized as they are entered. I've written the above Do loop, but when I run it I get the following message: Compile error: Loop without Do. I'm trying to get it to keep looping while text is being entered.
I've also tried doing this with an array, but it got messy....
Thanks in advance for any help.