| | |
Separating Names
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2007
Posts: 13
Reputation:
Solved Threads: 0
Im trying to Separate First Name, Middle Initial, and last name into Textboxes, with a function of a button.
Example :
Full Name : Tony J Holley
First Name: Tony
Middle Initial: J
Last Name: Holley
All I have is this, and is for the first name Separator:
' determines the person's first name
Dim name As String
name = txtfullname.Text
txtfirstname.Text = firstname(name)
End Sub
Function firstname(ByVal name As String) As String
Dim firstspace As Integer
firstspace = name.IndexOf(" ")
Return name.Substring(0, firstspace)
I don't know how to separate the middle Initial nor the Last name.
Thanks In Advance.
Example :
Full Name : Tony J Holley
First Name: Tony
Middle Initial: J
Last Name: Holley
All I have is this, and is for the first name Separator:
' determines the person's first name
Dim name As String
name = txtfullname.Text
txtfirstname.Text = firstname(name)
End Sub
Function firstname(ByVal name As String) As String
Dim firstspace As Integer
firstspace = name.IndexOf(" ")
Return name.Substring(0, firstspace)
I don't know how to separate the middle Initial nor the Last name.
Thanks In Advance.
you can use split method in string class
you can read more about array here and about string here
VB.NET Syntax (Toggle Plain Text)
Dim namepart(3) As String fullname = TextBox1.Text For i = 0 To TextBox1.Text.Length - 1 namepart = fullname.Split(" ") Next TextBox2.Text = namepart(0) TextBox3.Text = namepart(1) TextBox4.Text = namepart(2)
you can read more about array here and about string here
Last edited by manal; Oct 31st, 2007 at 2:47 am.
"give only what u willing to receive "
![]() |
Similar Threads
- Array with names (C)
- What is the error in sorting names and tolower function? (C++)
- names in ascending order problem (C++)
- Security(sharing) not working for domain users, names are not resolving..... (Windows NT / 2000 / XP)
- Turn Off File Names in Thumbnail View (Windows tips 'n' tweaks)
Other Threads in the VB.NET Forum
- Previous Thread: register page using SQL server
- Next Thread: can someone tell m whats the error!!!!
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access arithmetic array assignment basic binary bing box button buttons center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist editvb.net excel file-dialog firewall folder ftp google hardcopy image images isnumericfuntioncall listview login math memory mobile ms navigate net networking opacity output peertopeervideostreaming picturebox picturebox1 plugin port print problemwithinstallation project record reports" save savedialog searchbox serial server soap sorting sql string tcp temp text textbox timer toolbox trim updown upload useraccounts usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio web wpf







, me without this site
. THANKS AGAIN.