Please can some one help me with codes to check and see if a text box contains first name, space and surname

Recommended Answers

All 3 Replies

Quick reply. Thanks.

If you any problem in any of this forum.then reply on my mail.
Thanks

Please can some one help me with codes to check and see if a text box contains first name, space and surname

Dim sValue as string = TextBox1.Text

Dim pos As Integer = 0
Dim sValue As String = "Some Text"
Dim sFirstName As String = ""
Dim sLastName As String = ""

'look for a space in the text
pos = InStr(sValue, " ", CompareMethod.Text)
If pos > 0 Then
'a space was found
sFirstName = Mid(sValue, 1, pos - 1)
sLastName = Mid(sValue, pos, Len(sValue))
Else
MsgBox("You need to supply your full name", MsgBoxStyle.Information, "Full Name Required")
End If

Something along those lines...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.