Dadox,
There are any number of ways to do this, I normally use something like:
Dim text As String = "John Doe"
Dim save As String
Dim index As Integer = text.IndexOf(" "c)
If index = -1 Then
save = String.Empty
Else
save = text.Substring( 0, index)
text = text.Substring( index + 1)
End If
You may want to consider using Trim on text before the IndexOf and on text
after the SubString to removing leading & trailing spaces.
text = text.Trim()
text = text.TrimStart( " "c)
Dim index As Integer = text.IndexOf(" "c)
text = text.Substring( index + 1).Trim()
Trim or TrimStart can be used for leading spaces...
Hope this helps
Jay
"Dadox" <pa****@yahoo.c om> wrote in message
news:cd******** **@bagan.srce.h r...
Hi!
If I enter a name in textbox ("John Doe") for example,
how do I remove "John" If I click on command button to do so.
The point is to cut off first name and save it to array so only a last
name stays in textbox.
tnx