0

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

sample:

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?

5
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by cguan_77
0

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.

0

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

0

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.