Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split one string into many

Status
Not open for further replies.

paulcy82

Programmer
Jan 25, 2005
28
0
0
US
I have a form that asks the user to use a combo box and pick there name. If the user picks 'Jon Smith' I want to store this into two different variables. EX: firstName = Jon and lastName = Smith. I think conceptually I know how to do this, parse through the string and when you find a space then what is to the left is the first name and what is to the right is the last name. I just do not know how to do this programmatically.
 
Try

Code:
Dim parts() as String = Split(txtName.Text, " ")

Split is a built in function that will break apart a string at a specified delimiter.

Jay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top