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?

Recommended Answers

All 7 Replies

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?

you need to use the function REPLACE.

replace will work, and is more efficient than using left$().

how sir?

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.