VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This piece of code makes sure that the first letter of each word is a capital - useful in validatio

by UnReAl Android (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 4th April 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This piece of code makes sure that the first letter of each word is a capital - useful in validation checks for names etc.. Handy code!

API Declarations


'Created By Jason age 16
' here is one of my first progs!

Rate This piece of code makes sure that the first letter of each word is a capital - useful in validatio



'a command button called command1

'copy and paste the following code! 

Private Sub Command1_Click()
For n = 1 To Len(Text1.Text)
If n = 1 Then
If Asc(Mid$(Text1.Text, n, 1)) < 65 Or Asc(Mid$(Text1.Text, n, 1)) > 90 Then
MsgBox ("Something wrong!")
End If
End If
If spacefound = True Then
If Asc(Mid$(Text1.Text, n, 1)) < 65 Or Asc(Mid$(Text1.Text, n, 1)) > 90 Then
MsgBox ("Something wrong!")
End If
End If
If Asc(Mid$(Text1.Text, n, 1)) = 32 Then
spacefound = True
Else
spacefound = False
End If

Next n
End Sub




Download this snippet    Add to My Saved Code

This piece of code makes sure that the first letter of each word is a capital - useful in validatio Comments

No comments have been posted about This piece of code makes sure that the first letter of each word is a capital - useful in validatio. Why not be the first to post a comment about This piece of code makes sure that the first letter of each word is a capital - useful in validatio.

Post your comment

Subject:
Message:
0/1000 characters