how can i get the first name, the middle name and the last name in my textbox?

what i mean is i have 1 textbox to input his full name the format is this


Nash, Steve B.

then i have 3 label,
the first label is Your first name is Steve
your last name is Nash
and your middle name is B.

how can i came up in this answer?

9 Years
Discussion Span
Last Post by cguan_77

Split the data in the textbox by space... and then trim the extra characters... so something like:

parts = split(textbox1.text, " ")
rlname = parts(0)
rfname = parts(1)
rmname = parts(2)
label1.caption = rlname
label2.caption = rfname
label3.caption = rmname

You may want to do some error checking and exception handling... but meh.


sir comatose i have a problem how can i delete the camma? and the period in middle name?


with the code of Comatose and advise of Debasisdas ..
combining both will help to ease your problem..
here is it..

Private Sub Command1_Click()

parts = Split(Text1.Text, " ")
rlname = parts(0)
rfname = parts(1)
rmname = parts(2)
rlname = Replace(rlname, ",", "")
rmname = Replace(rmname, ".", "")

Label1.Caption = rlname
Label2.Caption = rfname
Label3.Caption = rmname
End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.