Separating Names

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2007
Posts: 13
Reputation: Magnusz is an unknown quantity at this point 
Solved Threads: 0
Magnusz Magnusz is offline Offline
Newbie Poster

Separating Names

 
0
  #1
Oct 30th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Separating Names

 
0
  #2
Oct 30th, 2007
>Tony J Holley

Does your name have three words in it always. Is each word separated by only one space. Please answer these questions.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 13
Reputation: Magnusz is an unknown quantity at this point 
Solved Threads: 0
Magnusz Magnusz is offline Offline
Newbie Poster

Re: Separating Names

 
0
  #3
Oct 30th, 2007
Yeah Three names and Yes only one space between names.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 121
Reputation: manal is an unknown quantity at this point 
Solved Threads: 17
manal's Avatar
manal manal is offline Offline
Junior Poster

Re: Separating Names

 
0
  #4
Oct 31st, 2007
you can use split method in string class
  1.  
  2.  
  3. Dim namepart(3) As String
  4. fullname = TextBox1.Text
  5.  
  6. For i = 0 To TextBox1.Text.Length - 1
  7. namepart = fullname.Split(" ")
  8. Next
  9. TextBox2.Text = namepart(0)
  10. TextBox3.Text = namepart(1)
  11. 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 "
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 13
Reputation: Magnusz is an unknown quantity at this point 
Solved Threads: 0
Magnusz Magnusz is offline Offline
Newbie Poster

Re: Separating Names

 
0
  #5
Nov 1st, 2007
It keeps telling me "i" is not declared ?
Last edited by Magnusz; Nov 1st, 2007 at 10:05 am.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 13
Reputation: Magnusz is an unknown quantity at this point 
Solved Threads: 0
Magnusz Magnusz is offline Offline
Newbie Poster

Re: Separating Names

 
0
  #6
Nov 1st, 2007
blah I got it, Thanks Manal , me without this site . THANKS AGAIN.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC